update 优化 判断当前会话是否已经登录
This commit is contained in:
parent
f3f3593cfe
commit
64d9b27310
@ -1,6 +1,5 @@
|
|||||||
package org.dromara.common.tenant.helper;
|
package org.dromara.common.tenant.helper;
|
||||||
|
|
||||||
import cn.dev33.satoken.stp.StpUtil;
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
@ -130,7 +129,7 @@ public class TenantHelper {
|
|||||||
if (!isEnable()) {
|
if (!isEnable()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!isLogin() || !global) {
|
if (!LoginHelper.isLogin() || !global) {
|
||||||
TEMP_DYNAMIC_TENANT.set(tenantId);
|
TEMP_DYNAMIC_TENANT.set(tenantId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -147,7 +146,7 @@ public class TenantHelper {
|
|||||||
if (!isEnable()) {
|
if (!isEnable()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (!isLogin()) {
|
if (!LoginHelper.isLogin()) {
|
||||||
return TEMP_DYNAMIC_TENANT.get();
|
return TEMP_DYNAMIC_TENANT.get();
|
||||||
}
|
}
|
||||||
// 如果线程内有值 优先返回
|
// 如果线程内有值 优先返回
|
||||||
@ -167,7 +166,7 @@ public class TenantHelper {
|
|||||||
if (!isEnable()) {
|
if (!isEnable()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!isLogin()) {
|
if (!LoginHelper.isLogin()) {
|
||||||
TEMP_DYNAMIC_TENANT.remove();
|
TEMP_DYNAMIC_TENANT.remove();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -218,13 +217,4 @@ public class TenantHelper {
|
|||||||
return tenantId;
|
return tenantId;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isLogin() {
|
|
||||||
try {
|
|
||||||
StpUtil.checkLogin();
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user