tudc преди 3 години
родител
ревизия
7ad67a629e

+ 7 - 0
tianhu-system/pom.xml

@@ -260,6 +260,13 @@
             <groupId>com.github.penggle</groupId>
             <artifactId>kaptcha</artifactId>
         </dependency>
+
+        <!-- 阿里短信服务 -->
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>dysmsapi20170525</artifactId>
+            <version>2.0.4</version>
+        </dependency>
     </dependencies>
 
     <build>

+ 5 - 1
tianhu-system/src/main/java/com/tianhu/system/common/impl/MessageUtilsServiceImpl.java

@@ -13,6 +13,7 @@ import com.tianhu.system.common.IMessageUtilsService;
 import com.tianhu.system.domain.PubVerifyCode;
 import com.tianhu.system.service.IPubVerifyCodeService;
 import com.tianhu.system.service.ISysConfigService;
+import com.tianhu.system.service.ISysDictDataService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -33,6 +34,8 @@ public class MessageUtilsServiceImpl implements IMessageUtilsService
     private IPubVerifyCodeService iPubVerifyCodeService;
     @Autowired
     private ISysConfigService configService;
+    @Autowired
+    private ISysDictDataService dictDataService;
     //手机号格式校验
     public static String MOBILE = "^1\\d{10}$";
     //验证码状态(未校验)
@@ -95,7 +98,8 @@ public class MessageUtilsServiceImpl implements IMessageUtilsService
 
         //调试模式
         boolean isTest = true;
-        String regVal = RedisUtils.getDictValue("aliyun_message_code", templateCode);
+//        String regVal = RedisUtils.getDictValue("aliyun_message_code", templateCode);
+        String regVal = dictDataService.selectDictValue("aliyun_message_code", templateCode);
 
         if(!isTest) {
             try {

+ 4 - 3
tianhu-system/src/main/java/com/tianhu/system/controller/MessageController.java

@@ -14,6 +14,7 @@ import com.tianhu.system.common.IMessageUtilsService;
 import com.tianhu.system.common.ValidateCodeService;
 import com.tianhu.system.domain.PubVerifyCode;
 import com.tianhu.system.service.IPubVerifyCodeService;
+import com.tianhu.system.service.ISysDictDataService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -62,7 +63,6 @@ public class MessageController extends BaseController
         return R.ok();
     }
 
-    @Log(title = "发送短信", businessType = BusinessType.INSERT)
     @Transactional(rollbackFor=Exception.class)
     @PostMapping("/sendShortMessage")
     public AjaxResult sendShortMessage(@RequestBody Map<String, String> requestBody) throws Exception {
@@ -109,8 +109,9 @@ public class MessageController extends BaseController
         Map<String, String> param = new HashMap<>();
         param.put("code", random);
         // 获取注册模板ID
-        String templateCode = RedisUtils.getDictValue("aliyun_message_code", "zhuce");
-        iMessageUtilsService.sendMessageCode(requestBody.get("phone"), templateCode, param, random);
+//        String templateCode = RedisUtils.getDictValue("aliyun_message_code", "zhuce");
+//        String templateCode = dictDataService.selectDictValue("aliyun_message_code", "zhuce");
+        iMessageUtilsService.sendMessageCode(requestBody.get("phone"), "zhuce", param, random);
         return AjaxResult.success();
     }
 }