From 2992a5ef78a742a762cfab47963d5366e765ef48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?niohe=C2=B7erbao?= Date: Thu, 16 Mar 2023 14:34:45 +0800 Subject: [PATCH] fix response success fix send verification --- .../com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java | 3 ++- pmapi/src/main/java/com/ningdatech/pmapi/sms/manage/SmsManage.java | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java index e1b5946..8c757c2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java @@ -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 { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sms/manage/SmsManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sms/manage/SmsManage.java index 2332a00..960136d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sms/manage/SmsManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sms/manage/SmsManage.java @@ -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());