fix 修复 session 多账号共用覆盖问题 改为 tokenSession 独立存储

2.X
疯狂的狮子Li 1 year ago
parent 8002888224
commit eb671c1412

@ -57,7 +57,7 @@ public class LoginHelper {
model.setExtra(TENANT_KEY, loginUser.getTenantId())
.setExtra(USER_KEY, loginUser.getUserId())
.setExtra(DEPT_KEY, loginUser.getDeptId()));
StpUtil.getSession().set(LOGIN_USER_KEY, loginUser);
StpUtil.getTokenSession().set(LOGIN_USER_KEY, loginUser);
}
/**
@ -65,7 +65,7 @@ public class LoginHelper {
*/
public static LoginUser getLoginUser() {
return (LoginUser) getStorageIfAbsentSet(LOGIN_USER_KEY, () -> {
SaSession session = StpUtil.getSession();
SaSession session = StpUtil.getTokenSession();
if (ObjectUtil.isNull(session)) {
return null;
}
@ -77,8 +77,7 @@ public class LoginHelper {
* token
*/
public static LoginUser getLoginUser(String token) {
Object loginId = StpUtil.getLoginIdByToken(token);
SaSession session = StpUtil.getSessionByLoginId(loginId);
SaSession session = StpUtil.getTokenSessionByToken(token);
if (ObjectUtil.isNull(session)) {
return null;
}

Loading…
Cancel
Save