发送验证码接口
This commit is contained in:
@@ -44,15 +44,15 @@ public class UserServiceImpl implements UserService {
|
|||||||
return Result.error("获取验证码次数过多,您的手机号已被限制!");
|
return Result.error("获取验证码次数过多,您的手机号已被限制!");
|
||||||
}
|
}
|
||||||
|
|
||||||
String blacklistIpAddrCount = stringRedisTemplate.opsForValue().get(GET_CODE_BLACKLIST_IP_ADDR + clientIpAddr);
|
// String blacklistIpAddrCount = stringRedisTemplate.opsForValue().get(GET_CODE_BLACKLIST_IP_ADDR + clientIpAddr);
|
||||||
int getCodeIpAddrCount = (blacklistIpAddrCount != null) ? Integer.parseInt(blacklistIpAddrCount) : 0;
|
// int getCodeIpAddrCount = (blacklistIpAddrCount != null) ? Integer.parseInt(blacklistIpAddrCount) : 0;
|
||||||
if (getCodeIpAddrCount >= 300) {
|
// if (getCodeIpAddrCount >= 300) {
|
||||||
return Result.error("获取验证码次数过多,您的IP已被限制!");
|
// return Result.error("获取验证码次数过多,您的IP已被限制!");
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 6.更新锁和黑名单
|
// 6.更新锁和黑名单
|
||||||
stringRedisTemplate.opsForValue().set(GET_CODE_BLACKLIST_PHONE + phone, String.valueOf(getCodePhoneCount + 1), REFRESH_BLACKLIST_TTL, TimeUnit.HOURS);
|
stringRedisTemplate.opsForValue().set(GET_CODE_BLACKLIST_PHONE + phone, String.valueOf(getCodePhoneCount + 1), REFRESH_BLACKLIST_TTL, TimeUnit.HOURS);
|
||||||
stringRedisTemplate.opsForValue().set(GET_CODE_BLACKLIST_IP_ADDR + clientIpAddr, String.valueOf(getCodeIpAddrCount + 1), REFRESH_BLACKLIST_TTL, TimeUnit.HOURS);
|
// stringRedisTemplate.opsForValue().set(GET_CODE_BLACKLIST_IP_ADDR + clientIpAddr, String.valueOf(getCodeIpAddrCount + 1), REFRESH_BLACKLIST_TTL, TimeUnit.HOURS);
|
||||||
stringRedisTemplate.opsForValue().set(GET_CODE_LOCK + phone, "1", GET_CODE_LOCK_TTL, TimeUnit.MINUTES);
|
stringRedisTemplate.opsForValue().set(GET_CODE_LOCK + phone, "1", GET_CODE_LOCK_TTL, TimeUnit.MINUTES);
|
||||||
|
|
||||||
// 7.校验通过,生成验证码
|
// 7.校验通过,生成验证码
|
||||||
|
|||||||
Reference in New Issue
Block a user