修复redis的string问题

This commit is contained in:
zhongzb
2023-05-09 21:45:24 +08:00
parent b39a1bdf0c
commit 7f2248cbf5
2 changed files with 3 additions and 3 deletions

View File

@@ -216,12 +216,12 @@ public class RedisUtils {
* @param key 键 * @param key 键
* @return 值 * @return 值
*/ */
public static String get(String key) { private static String get(String key) {
return key == null ? null : stringRedisTemplate.opsForValue().get(key); return key == null ? null : stringRedisTemplate.opsForValue().get(key);
} }
public static String getStr(String key) { public static String getStr(String key) {
return stringRedisTemplate.opsForValue().get(key); return get(key,String.class);
} }
public static <T> T get(String key, Class<T> tClass) { public static <T> T get(String key, Class<T> tClass) {

View File

@@ -45,7 +45,7 @@ public class LoginServiceImpl implements LoginService {
return false; return false;
} }
String key = RedisKey.getKey(RedisKey.USER_TOKEN_STRING, uid); String key = RedisKey.getKey(RedisKey.USER_TOKEN_STRING, uid);
String realToken = redisUtils.get(key); String realToken = redisUtils.getStr(key);
return token.equals(realToken);//有可能token失效了需要校验是不是和最新token一致 return token.equals(realToken);//有可能token失效了需要校验是不是和最新token一致
} }