redis反序列化问题

This commit is contained in:
2025-12-19 19:04:43 +08:00
parent 1131a34c6e
commit 566d03491b
15 changed files with 123 additions and 140 deletions

View File

@@ -210,7 +210,7 @@ public class AuthController {
// 通过sessionId验证手机验证码
String smsCodeKey = "sms:code:" + smsSessionId;
String storedSmsValue = (String) redisService.get(smsCodeKey);
String storedSmsValue = redisService.get(smsCodeKey, String.class);
if (storedSmsValue == null) {
return ResultDomain.failure("验证码已过期,请重新获取");
}
@@ -258,7 +258,7 @@ public class AuthController {
// 通过sessionId验证邮箱验证码
String emailCodeKey = "email:code:" + emailSessionId;
String storedEmailValue = (String) redisService.get(emailCodeKey);
String storedEmailValue = redisService.get(emailCodeKey, String.class);
if (storedEmailValue == null) {
return ResultDomain.failure("验证码已过期,请重新获取");
}

View File

@@ -160,7 +160,7 @@ public class AuthServiceImpl implements AuthService{
// 2. 从Redis获取登录信息
String loginKey = "login:token:" + token;
String loginJson = (String) redisService.get(loginKey);
String loginJson = redisService.get(loginKey, String.class);
if (loginJson == null) {
return ResultDomain.failure("登录信息已失效");
}
@@ -422,7 +422,7 @@ public class AuthServiceImpl implements AuthService{
// 2. 从Redis获取登录信息
String loginKey = "login:token:" + token;
String loginJson = (String) redisService.get(loginKey);
String loginJson = redisService.get(loginKey, String.class);
if (loginJson == null) {
return ResultDomain.failure("登录信息已失效");
}
@@ -481,7 +481,7 @@ public class AuthServiceImpl implements AuthService{
// 1. 从Redis获取登录信息
String loginKey = "login:token:" + token;
String loginJson = (String) redisService.get(loginKey);
String loginJson = redisService.get(loginKey, String.class);
if (loginJson == null) {
return ResultDomain.success("登出成功", (LoginDomain) null); // 已经过期的token直接返回成功
}

View File

@@ -77,7 +77,7 @@ public class EmailLoginStrategy implements LoginStrategy {
// 从Redis获取验证码
String codeKey = "email:code:" + captchaId;
String storedValue = (String) redisService.get(codeKey);
String storedValue = redisService.get(codeKey, String.class);
if (storedValue == null) {
return false;

View File

@@ -78,7 +78,7 @@ public class PhoneLoginStrategy implements LoginStrategy {
// 从Redis获取验证码
String codeKey = "sms:code:" + captchaId;
String storedValue = (String) redisService.get(codeKey);
String storedValue = redisService.get(codeKey, String.class);
if (storedValue == null) {
return false;