完善手机号校验和验证码发送限制

This commit is contained in:
2026-09-16 09:22:30 +08:00
parent 0c827782ff
commit e8e8e5a404
12 changed files with 44 additions and 12 deletions
@@ -97,11 +97,10 @@ public class VerificationCodeServiceImpl implements VerificationCodeService {
String codeKey = CODE_PREFIX + phone;
String sendTimeKey = SEND_TIME_PREFIX + phone;
messageHubClientService.sendSmsVerificationCode(sceneCode, phone, code);
redisTemplate.opsForValue().set(codeKey, code, Duration.ofMinutes(CODE_EXPIRE_MINUTES));
redisTemplate.opsForValue().set(sendTimeKey, String.valueOf(System.currentTimeMillis()),
Duration.ofSeconds(RESEND_INTERVAL_SECONDS));
messageHubClientService.sendSmsVerificationCode(sceneCode, phone, code);
log.info("验证码已发送,手机号: {}, sceneCode: {}", phone, sceneCode);
}