Browse Source

sms模板nacos配置化

lyhzzz 1 năm trước cách đây
mục cha
commit
afd0b16e8e

+ 4 - 3
src/main/java/com/fdkankan/ucenter/controller/TestController.java

@@ -111,10 +111,11 @@ public class TestController extends BaseController {
     @Autowired
     SmsService smsService;
     @GetMapping("/sendMail3")
-    public Result sendMail3(@RequestParam(required = false)String userName) throws Exception {
+    public Result sendMail3(@RequestParam(required = false)String userName,
+                            @RequestParam(required = false)String templateParam,
+                            @RequestParam(required = false)String templateCode) throws Exception {
         //luomin@cgaii.com
-        String cnCode = "SMS_295240730";
-        smsService.sendSms(userName, "{\"code\":\" + yzmStr + \"}", cnCode);
+        smsService.sendSms(userName, templateParam, templateCode);
         return Result.success( );
     }
     @GetMapping("/test1")

+ 1 - 1
src/main/java/com/fdkankan/ucenter/service/impl/LoginService.java

@@ -55,7 +55,7 @@ public class LoginService {
     private ICameraDetailService cameraDetailService;
     @Autowired
     private ILoginLogService loginLogService;
-    @Value("${phone.code.cn}")
+    @Value("${sms.template.verification-code}")
     private String cnCode;
     @Value("${admin.register.validCode:2a22bac40f44af4d3b5fdc20ea706fc5}")
     private String registerValidCode;

+ 5 - 2
src/main/java/com/fdkankan/ucenter/service/impl/UserIncrementServiceImpl.java

@@ -25,6 +25,7 @@ import jodd.util.StringUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import java.util.*;
@@ -336,9 +337,11 @@ public class UserIncrementServiceImpl extends ServiceImpl<IUserIncrementMapper,
         this.sendMsg(userIdsSE,"SE");
     }
 
+    @Value("${sms.template.increment-to-be-expire}")
+    private String cnCode;
+    @Value("${sms.template.increment-expire}")
+    private String expireCode;
     private void sendMsg(Map<Long, Integer> userIds,String msgType) throws Exception {
-        String cnCode = "SMS_216275556";
-        String expireCode = "SMS_216425565";
         for (Long userId : userIds.keySet()) {
             User userEntity = userService.getById(userId);
             if(userEntity != null){