修改redis工具类问题
This commit is contained in:
@@ -29,7 +29,6 @@ import java.time.Duration;
|
||||
public class FadAppAuthServiceImpl implements IFadAppAuthService {
|
||||
|
||||
private final ISysUserService userService;
|
||||
private final RedisUtils redisUtils;
|
||||
private final SysPermissionService permissionService;
|
||||
|
||||
/**
|
||||
@@ -59,7 +58,7 @@ public class FadAppAuthServiceImpl implements IFadAppAuthService {
|
||||
|
||||
// 存储验证码到Redis(5分钟过期)
|
||||
String key = CODE_PREFIX + phone;
|
||||
redisUtils.setCacheObject(key, code, Duration.ofMinutes(CODE_EXPIRE_MINUTES));
|
||||
RedisUtils.setCacheObject(key, code, Duration.ofMinutes(CODE_EXPIRE_MINUTES));
|
||||
|
||||
// 记录日志(实际项目中这里会调用短信服务)
|
||||
log.info("向手机号 {} 发送验证码: {}", phone, code);
|
||||
@@ -79,7 +78,7 @@ public class FadAppAuthServiceImpl implements IFadAppAuthService {
|
||||
|
||||
// 从Redis获取存储的验证码
|
||||
String key = CODE_PREFIX + phone;
|
||||
String storedCode = redisUtils.getCacheObject(key);
|
||||
String storedCode = RedisUtils.getCacheObject(key);
|
||||
|
||||
if (storedCode == null) {
|
||||
throw new ServiceException("验证码已过期,请重新获取");
|
||||
@@ -90,7 +89,7 @@ public class FadAppAuthServiceImpl implements IFadAppAuthService {
|
||||
}
|
||||
|
||||
// 验证码验证通过,删除Redis中的验证码
|
||||
redisUtils.deleteObject(key);
|
||||
RedisUtils.deleteObject(key);
|
||||
|
||||
// 查找或创建用户
|
||||
SysUser user = findOrCreateUser(phone);
|
||||
|
||||
Reference in New Issue
Block a user