Просмотр исходного кода

发送短信账号不存在拦截

wangyunpeng 3 дней назад
Родитель
Сommit
4f63afbe50

+ 7 - 0
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformAccountServiceImpl.java

@@ -117,6 +117,13 @@ public class ContentPlatformAccountServiceImpl implements ContentPlatformAccount
 
     @Override
     public void sendMessageVerifyCode(AccountSendMessageParam param) {
+        if (!StringUtils.hasText(param.getTelNum())) {
+            throw new CommonException(ExceptionEnum.ACCOUNT_NOT_EXISTS_WRONG);
+        }
+        ContentPlatformAccount account = getAccountByTelNum(param.getTelNum());
+        if (Objects.isNull(account)) {
+            throw new CommonException(ExceptionEnum.ACCOUNT_NOT_EXISTS_WRONG);
+        }
         String verifyCode = VerificationCodeGenerator.generateVerificationCode(6);
         SendShortMessageUtil.sendVerifyCode(param.getTelNum(), verifyCode);
         ContentPlatformVerifyCode verifyCodePO = new ContentPlatformVerifyCode();