mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2025-09-08 13:27:46 +00:00
update 优化 在线用户token获取方式
This commit is contained in:
@@ -7,11 +7,6 @@ package com.ruoyi.common.core.constant;
|
||||
*/
|
||||
public interface CacheConstants {
|
||||
|
||||
/**
|
||||
* 登录用户 redis key
|
||||
*/
|
||||
String LOGIN_TOKEN_KEY = "Authorization:login:token:";
|
||||
|
||||
/**
|
||||
* 在线用户 redis key
|
||||
*/
|
||||
|
@@ -43,7 +43,7 @@ public class SysUserOnlineController extends BaseController {
|
||||
List<String> keys = StpUtil.searchTokenValue("", 0, -1, false);
|
||||
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
|
||||
for (String key : keys) {
|
||||
String token = key.replace(CacheConstants.LOGIN_TOKEN_KEY, "");
|
||||
String token = StringUtils.substringAfterLast(key, ":");
|
||||
// 如果已经过期则踢下线
|
||||
if (StpUtil.stpLogic.getTokenActivityTimeoutByToken(token) < -1) {
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user