From cbc646605228445175c1052dde887b51cc11554a 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: Mon, 19 Sep 2022 18:19:24 +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=B7=E8=AE=BE=E7=BD=AE=E6=B0=B8=E4=B8=8D=E8=BF=87?= =?UTF-8?q?=E6=9C=9F=20=E8=B6=85=E6=97=B6=E6=97=B6=E9=97=B4-1=E6=8E=A8?= =?UTF-8?q?=E9=80=81redis=E6=97=A0=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/auth/listener/UserActionListener.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ruoyi-auth/src/main/java/com/ruoyi/auth/listener/UserActionListener.java b/ruoyi-auth/src/main/java/com/ruoyi/auth/listener/UserActionListener.java index 39fad0ad..b15bab04 100644 --- a/ruoyi-auth/src/main/java/com/ruoyi/auth/listener/UserActionListener.java +++ b/ruoyi-auth/src/main/java/com/ruoyi/auth/listener/UserActionListener.java @@ -53,7 +53,11 @@ public class UserActionListener implements SaTokenListener { if (ObjectUtil.isNotNull(user.getDeptName())) { userOnline.setDeptName(user.getDeptName()); } - RedisUtils.setCacheObject(CacheConstants.ONLINE_TOKEN_KEY + tokenValue, userOnline, Duration.ofSeconds(tokenConfig.getTimeout())); + if(tokenConfig.getTimeout() == -1) { + RedisUtils.setCacheObject(CacheConstants.ONLINE_TOKEN_KEY + tokenValue, userOnline); + } else { + RedisUtils.setCacheObject(CacheConstants.ONLINE_TOKEN_KEY + tokenValue, userOnline, Duration.ofSeconds(tokenConfig.getTimeout())); + } log.info("user doLogin, useId:{}, token:{}", loginId, tokenValue); } else if (userType == UserType.APP_USER) { // app端 自行根据业务编写