From 013c96e2f81f97a2c5346f7f91e24519fa7509ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 20 Apr 2023 13:06:10 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20=E5=9C=A8?= =?UTF-8?q?=E7=BA=BF=E7=94=A8=E6=88=B7token=E8=8E=B7=E5=8F=96=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/common/core/constant/CacheConstants.java | 5 ----- .../com/ruoyi/system/controller/SysUserOnlineController.java | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/CacheConstants.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/CacheConstants.java index 7b77307a..746bfa56 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/CacheConstants.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/CacheConstants.java @@ -7,11 +7,6 @@ package com.ruoyi.common.core.constant; */ public interface CacheConstants { - /** - * 登录用户 redis key - */ - String LOGIN_TOKEN_KEY = "Authorization:login:token:"; - /** * 在线用户 redis key */ diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserOnlineController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserOnlineController.java index c7d4a1fe..b64ac7a1 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserOnlineController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserOnlineController.java @@ -43,7 +43,7 @@ public class SysUserOnlineController extends BaseController { List keys = StpUtil.searchTokenValue("", 0, -1, false); List userOnlineList = 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;