From 4f015b8c624484e0c3b2d88b944163ce43a48d1f Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 27 十一月 2021 17:15:28 +0800
Subject: [PATCH] 功能完善

---
 app/src/main/java/com/yeshi/location/app/controller/client/api/SMSController.java |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/app/src/main/java/com/yeshi/location/app/controller/client/api/SMSController.java b/app/src/main/java/com/yeshi/location/app/controller/client/api/SMSController.java
index 026bbfa..451292f 100644
--- a/app/src/main/java/com/yeshi/location/app/controller/client/api/SMSController.java
+++ b/app/src/main/java/com/yeshi/location/app/controller/client/api/SMSController.java
@@ -1,5 +1,6 @@
 package com.yeshi.location.app.controller.client.api;
 
+import com.github.qcloudsms.SmsSingleSenderResult;
 import com.yeshi.location.app.entity.config.SystemConfigKey;
 import com.yeshi.location.app.service.inter.config.SystemConfigService;
 import com.yeshi.location.app.service.manager.VerifyCodeManager;
@@ -46,7 +47,7 @@
     @ResponseBody
     @RequestMapping("sendSMS")
     public String sendSMS(AcceptData acceptData, String phone) {
-        if (StringUtil.isMobile(phone)) {
+        if (!StringUtil.isMobile(phone)) {
             return JsonUtil.loadFalseResult("鎵嬫満鍙锋牸寮忛敊璇�");
         }
         String key = "sendsms-" + phone;
@@ -56,10 +57,14 @@
             String msg = systemConfigService.getValueCache(acceptData.getSystem(), SystemConfigKey.tencentVerifySMSTemplate);
             String appId = systemConfigService.getValueCache(acceptData.getSystem(), SystemConfigKey.tencentSMSAppId);
             String appKey = systemConfigService.getValueCache(acceptData.getSystem(), SystemConfigKey.tencentSMSAppKey);
-            //  SmsSingleSenderResult result=
-//            TencentSMSUtil.sendSingleMsg(Integer.parseInt(appId), appKey, phone, msg.replace("{楠岃瘉鐮亇", code));
-            verifyCodeManager.sendSMSSuccess(phone, code);
-            return JsonUtil.loadTrueResult("");
+            SmsSingleSenderResult result =
+                    TencentSMSUtil.sendSingleMsg(Integer.parseInt(appId), appKey, phone, msg.replace("{楠岃瘉鐮亇", code));
+            if (result.result == 0) {
+                verifyCodeManager.sendSMSSuccess(phone, code);
+                return JsonUtil.loadTrueResult("");
+            } else {
+                return JsonUtil.loadFalseResult(result.errMsg);
+            }
         } else {
             return JsonUtil.loadFalseResult("鏈嶅姟鍣ㄧ箒蹇欙紝璇风◢鍚庡啀璇�");
         }

--
Gitblit v1.8.0