update 优化 在线用户token获取方式

This commit is contained in:
疯狂的狮子li 2023-04-20 13:04:29 +08:00
parent a312794423
commit 68404f3f6e
2 changed files with 1 additions and 6 deletions

View File

@ -45,7 +45,7 @@ public class SysUserOnlineController extends BaseController {
List<String> keys = StpUtil.searchTokenValue("", 0, -1, false);
List<UserOnlineDTO> userOnlineDTOList = new ArrayList<>();
for (String key : keys) {
String token = key.replace(CacheConstants.LOGIN_TOKEN_KEY, "");
String token = StringUtils.substringAfterLast(key, ":");
// 如果已经过期则跳过
if (StpUtil.stpLogic.getTokenActivityTimeoutByToken(token) < -1) {
continue;

View File

@ -7,11 +7,6 @@ package com.ruoyi.common.constant;
*/
public interface CacheConstants {
/**
* 登录用户 redis key
*/
String LOGIN_TOKEN_KEY = "Authorization:login:token:";
/**
* 在线用户 redis key
*/