update 优化判断当前会话是否已经登录

This commit is contained in:
AprilWind 2024-09-13 13:52:05 +08:00
parent f3f3593cfe
commit 597eabc8a6

View File

@ -130,7 +130,7 @@ public class TenantHelper {
if (!isEnable()) {
return;
}
if (!isLogin() || !global) {
if (!StpUtil.isLogin() || !global) {
TEMP_DYNAMIC_TENANT.set(tenantId);
return;
}
@ -147,7 +147,7 @@ public class TenantHelper {
if (!isEnable()) {
return null;
}
if (!isLogin()) {
if (!StpUtil.isLogin()) {
return TEMP_DYNAMIC_TENANT.get();
}
// 如果线程内有值 优先返回
@ -167,7 +167,7 @@ public class TenantHelper {
if (!isEnable()) {
return;
}
if (!isLogin()) {
if (!StpUtil.isLogin()) {
TEMP_DYNAMIC_TENANT.remove();
return;
}
@ -218,13 +218,4 @@ public class TenantHelper {
return tenantId;
}
private static boolean isLogin() {
try {
StpUtil.checkLogin();
return true;
} catch (Exception e) {
return false;
}
}
}