|
@@ -82,8 +82,10 @@ public class SmsManage { |
|
|
|
|
|
|
|
|
cachePlusOps.set(new CacheKey(cacheKey, Duration.ofMinutes(verificationCodeTypeEnum.getExpireTime())), cache); |
|
|
cachePlusOps.set(new CacheKey(cacheKey, Duration.ofMinutes(verificationCodeTypeEnum.getExpireTime())), cache); |
|
|
String limitKey = SmsRedisKeyUtils.smsSendLimitKey(verificationCodeTypeEnum, request.getMobile()); |
|
|
String limitKey = SmsRedisKeyUtils.smsSendLimitKey(verificationCodeTypeEnum, request.getMobile()); |
|
|
if (StringUtils.isNotBlank(cachePlusOps.get(limitKey))) { |
|
|
|
|
|
long limitCount = cachePlusOps.incr(new CacheKey(limitKey, Duration.ofSeconds(DateUtil.restSecondsFromNowToNoon()))); |
|
|
|
|
|
|
|
|
if (Objects.nonNull(cachePlusOps.get(limitKey))) { |
|
|
|
|
|
Integer limitCount = cachePlusOps.get(limitKey); |
|
|
|
|
|
cachePlusOps.set(new CacheKey(limitKey, Duration.ofSeconds(DateUtil.restSecondsFromNowToNoon())), limitCount++); |
|
|
|
|
|
// long limitCount = cachePlusOps.incr(new CacheKey(limitKey, Duration.ofSeconds(DateUtil.restSecondsFromNowToNoon()))); |
|
|
// 超出单日发送次数之后直接锁定 |
|
|
// 超出单日发送次数之后直接锁定 |
|
|
if (limitCount >= verificationCodeTypeEnum.getSendTimesByDay().longValue()) { |
|
|
if (limitCount >= verificationCodeTypeEnum.getSendTimesByDay().longValue()) { |
|
|
cachePlusOps.set(new CacheKey(lockKey, Duration.ofSeconds(DateUtil.restSecondsFromNowToNoon())), request.getMobile()); |
|
|
cachePlusOps.set(new CacheKey(lockKey, Duration.ofSeconds(DateUtil.restSecondsFromNowToNoon())), request.getMobile()); |
|
|