From 21cd7a887a4b262bd2aa2af37cc0f45ce1241319 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B5=B5=E5=95=B8=E9=9D=9E?= <8153694@qq.com>
Date: Thu, 30 Nov 2023 09:10:06 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9redis=E9=89=B4=E6=9D=83?=
 =?UTF-8?q?=E7=A1=AE=E8=AE=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../interceptor/AuthTokenServiceImpl.java        | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/base-manager/src/main/java/com/mortals/xhx/base/framework/interceptor/AuthTokenServiceImpl.java b/base-manager/src/main/java/com/mortals/xhx/base/framework/interceptor/AuthTokenServiceImpl.java
index 863c3e36..e8b4c07f 100644
--- a/base-manager/src/main/java/com/mortals/xhx/base/framework/interceptor/AuthTokenServiceImpl.java
+++ b/base-manager/src/main/java/com/mortals/xhx/base/framework/interceptor/AuthTokenServiceImpl.java
@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Primary;
 import org.springframework.core.annotation.Order;
+import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.util.ObjectUtils;
 
@@ -106,19 +107,20 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
                 Claims claims = parseToken(token);
                 String uuid = (String) claims.get(SysConstains.LOGIN_USER_KEY);
                 String userKey = getTokenKey(uuid);
-                cacheService.select(portalDb);
-                String userStr = cacheService.get(userKey);
+               // cacheService.select(portalDb);
+
+                RedisTemplate<String, String> redisTemplate = cacheService.selectDbRedisTemplate(portalDb);
+
+                String userStr =redisTemplate.opsForValue().get(userKey);
+               // String userStr = cacheService.get(userKey);
                 //鍒锋柊token鏃堕棿
                 UserEntity userEntity = JSONObject.parseObject(userStr, UserEntity.class);
                 if (!ObjectUtils.isEmpty(userEntity)) {
                     verifyToken(userEntity);
                 }
-                cacheService.select(db);
+               // cacheService.select(db);
                 if (!ObjectUtils.isEmpty(userEntity)) {
-//                    UserEntity temp = userService.selectOne(new UserQuery().loginName(userEntity.getLoginName()));
-//                    if(!ObjectUtils.isEmpty(temp)){
-//                        userEntity.setId(temp.getId());
-//                    }
+
                     UserEntity temp = userService.getExtCache(userEntity.getLoginName());
                     if (!ObjectUtils.isEmpty(temp)) {
                         userEntity.setId(temp.getId());
-- 
2.24.3