From c9e9341b4a1fb0e97e442fb728eab402c6e58f70 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, 9 Dec 2021 17:53:36 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20=E5=9C=A8=E7=BA=BF?= =?UTF-8?q?=E7=94=A8=E6=88=B7key=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/monitor/SysUserOnlineController.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java index e8e27501a..2faf3318d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java @@ -46,12 +46,12 @@ public class SysUserOnlineController extends BaseController { List keys = StpUtil.searchTokenValue("", -1, 0); List userOnlineDTOList = new ArrayList<>(); for (String key : keys) { + String token = key.replace(Constants.LOGIN_TOKEN_KEY, ""); // 如果已经过期则踢下线 - if (StpUtil.stpLogic.getTokenActivityTimeoutByToken(key) < 0) { + if (StpUtil.stpLogic.getTokenActivityTimeoutByToken(token) < 0) { continue; } - String onlineKey = key.replace(Constants.LOGIN_TOKEN_KEY, Constants.ONLINE_TOKEN_KEY); - userOnlineDTOList.add(RedisUtils.getCacheObject(onlineKey)); + userOnlineDTOList.add(RedisUtils.getCacheObject(Constants.ONLINE_TOKEN_KEY + token)); } if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) { userOnlineDTOList = userOnlineDTOList.stream().filter(userOnline ->