admin
2021-11-27 4f015b8c624484e0c3b2d88b944163ce43a48d1f
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("服务器繁忙,请稍后再试");
        }