limingming 1 year ago
parent
commit
04e4cc9975

+ 41 - 0
rouyi-api/src/main/java/com/info666/infraredRemote/config/SMSProperties.java

@@ -0,0 +1,41 @@
+package com.info666.infraredRemote.config;
+
+import lombok.Data;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author liming
+ * @date 2023/08/02
+ */
+@Data
+@Component
+public class SMSProperties {
+
+    /**
+     * accessKeyId
+     */
+    @Value("${aliyun.sms.accessKeyId}")
+    private String accessKeyId;
+
+    /**
+     * accessKeySecret
+     */
+    @Value("${aliyun.sms.accessKeySecret}")
+    private String accessKeySecret;
+
+    /**
+     * 短信签名
+     */
+    @Value("${aliyun.sms.signName}")
+    private String signName;
+
+    /**
+     * 短信模板
+     */
+    @Value("${aliyun.sms.templateCode}")
+    private String templateCode;
+
+
+
+}

+ 2 - 0
rouyi-api/src/main/java/com/info666/infraredRemote/controller/UserLoginController.java

@@ -63,6 +63,8 @@ public class UserLoginController {
      */
     @PostMapping("/uploadAddress")
     public R<SmsResponseVo> sendSms(@RequestBody UserAddress param) {
+        UserInfo one = userInfoService.getOne(new LambdaQueryWrapper<UserInfo>().eq(UserInfo::getUserPhone, param.getUserPhone()),false);
+        param.setUserId(one.getId());
         param.setCreateTime(DateUtils.getNowDate());
         userAddressService.save(param);
         return R.ok();

+ 11 - 0
rouyi-api/src/main/resources/application.yml

@@ -148,3 +148,14 @@ xss:
   excludes: /system/notice
   # 匹配链接
   urlPatterns: /system/*,/monitor/*,/tool/*
+
+#自定义短信模板配置
+aliyun:
+  sms:
+    accessKeyId: LTAI5tKvxXUQ61e5PSm3mzQ1
+    accessKeySecret: WEzhPLHWqEINBbiLn168g2nP1H8Cje
+    #短信签名
+    signName: 阿里云短信测试
+    #短信模板
+    templateCode: SMS_154950909
+