satoken增加获取用户名方法

This commit is contained in:
张松
2025-02-21 09:50:41 +08:00
parent 5a78919b9b
commit 62b05eb0f3
4 changed files with 15 additions and 5 deletions

View File

@@ -123,7 +123,7 @@ public class AuthorizationServiceImpl implements AuthorizationService {
}
}
StpKit.USER.login(user.getId(), shopInfo.getId(), isStaff ? MyStpLogic.LoginType.STAFF :MyStpLogic.LoginType.MANAGER, user.getIsAdmin());
StpKit.USER.login(user.getId(), user.getAccount(), shopInfo.getId(), isStaff ? MyStpLogic.LoginType.STAFF :MyStpLogic.LoginType.MANAGER, user.getIsAdmin());
// 查询角色
List<SysRole> roleList = sysRoleService.getByUserId(user.getId());
List<String> roleNames = roleList.stream().map(SysRole::getName).collect(Collectors.toList());

View File

@@ -64,7 +64,7 @@ public class UserAuthorizationServiceImpl implements UserAuthorizationService {
userInfo.setLastLoginTime(DateUtil.date().toLocalDateTime());
userInfoService.saveOrUpdate(userInfo);
// StpKit.USER.login(userInfo.getId());
StpKit.USER.login(userInfo.getId(), null, MyStpLogic.LoginType.USER, false);
StpKit.USER.login(userInfo.getId(), openId, null, MyStpLogic.LoginType.USER, false);
return new LoginTokenDTO(StpKit.USER.getTokenValue(), userInfo);
}
}