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

2.X
疯狂的狮子li 2 years ago
parent 06fa3aee68
commit 013c96e2f8

@ -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;

Loading…
Cancel
Save