#334 修改阿里云短信至yaml文件

已合并
gez 17 小时之前 将 1 次代码提交从 uskycloud/system-zjy合并至 uskycloud/master

+ 11 - 1
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/controller/web/SendSmsController.java

@@ -16,6 +16,7 @@ import com.usky.system.domain.SysMobileTenantConfig;
 import com.usky.system.domain.SysUser;
 import com.usky.system.mapper.SysUserMapper;
 import com.usky.system.service.ISysUserService;
+import org.springframework.beans.factory.annotation.Value;
 import com.usky.system.service.SysMobileTenantConfigService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -47,13 +48,22 @@ public class SendSmsController {
     @Autowired
     private ISysUserService sysUserService;
 
+    @Value("${sms.ali.region-id}")
+    private String regionId;
+
+    @Value("${sms.ali.access-key-id}")
+    private String accessKeyId;
+
+    @Value("${sms.ali.access-key-secret}")
+    private String accessKeySecret;
+
     @GetMapping("/noteSending")
     public ApiResult<Void> noteSending(@RequestParam(value = "tenantId" ,required = false) Integer tenantId,@RequestParam(value = "phone") String phone) {
         if((tenantId != null) && !StringUtils.isBlank(phone)){
             sysUserService.getAppUserInfo(null, tenantId, phone,null);
         }
 
-        DefaultProfile profile = DefaultProfile.getProfile("cn-beijing", "LTAI9WERPIFIlHDg", "p7SQ0rYpraebcdoJ0l3tOtYmmgrR4q");
+        DefaultProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret);
         String code = String.valueOf(new Random().nextInt(1000000));
         redisHelper.set(phone,code,300,TimeUnit.SECONDS);//key为手机号,value为验证码存储
         IAcsClient client = new DefaultAcsClient(profile);