Browse Source

fix response success

fix send verification
tags/24080901
niohe·erbao 1 year ago
parent
commit
2992a5ef78
2 changed files with 6 additions and 3 deletions
  1. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java
  2. +4
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/sms/manage/SmsManage.java

+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java View File

@@ -24,7 +24,8 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
"com.ningdatech.pmapi.todocenter.controller",
"com.ningdatech.pmapi.user.controller",
"com.ningdatech.pmapi.meeting.controller",
"com.ningdatech.pmapi.expert.controller"
"com.ningdatech.pmapi.expert.controller",
"com.ningdatech.pmapi.sms.controller"
})
public class GlobalResponseHandler implements ResponseBodyAdvice<Object> {



+ 4
- 2
pmapi/src/main/java/com/ningdatech/pmapi/sms/manage/SmsManage.java View File

@@ -82,8 +82,10 @@ public class SmsManage {

cachePlusOps.set(new CacheKey(cacheKey, Duration.ofMinutes(verificationCodeTypeEnum.getExpireTime())), cache);
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()) {
cachePlusOps.set(new CacheKey(lockKey, Duration.ofSeconds(DateUtil.restSecondsFromNowToNoon())), request.getMobile());


Loading…
Cancel
Save