|
@@ -0,0 +1,63 @@
|
|
|
+package com.usky.system.controller.web;
|
|
|
+
|
|
|
+
|
|
|
+import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
|
|
+import com.aliyuncs.DefaultAcsClient;
|
|
|
+import com.aliyuncs.IAcsClient;
|
|
|
+import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
|
|
|
+import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
|
|
|
+import com.aliyuncs.exceptions.ClientException;
|
|
|
+import com.aliyuncs.profile.DefaultProfile;
|
|
|
+import com.usky.common.core.bean.ApiResult;
|
|
|
+import com.usky.common.redis.core.RedisHelper;
|
|
|
+import com.usky.system.domain.SysMobileTenantConfig;
|
|
|
+import com.usky.system.service.SysMobileTenantConfigService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.rmi.ServerException;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Random;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 移动端_租户配置表 前端控制器
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author JCB
|
|
|
+ * @since 2022-08-09
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/SendSms")
|
|
|
+public class SendSmsController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private RedisHelper redisHelper;
|
|
|
+
|
|
|
+ @GetMapping("/noteSending")
|
|
|
+ public ApiResult<Void> noteSending(@RequestParam String phone) {
|
|
|
+ DefaultProfile profile = DefaultProfile.getProfile("cn-beijing", "LTAI9WERPIFIlHDg", "p7SQ0rYpraebcdoJ0l3tOtYmmgrR4q");
|
|
|
+ String code = String.valueOf(new Random().nextInt(1000000));
|
|
|
+ redisHelper.set("Verify",code);
|
|
|
+ IAcsClient client = new DefaultAcsClient(profile);
|
|
|
+ SendSmsRequest request = new SendSmsRequest();
|
|
|
+ request.setPhoneNumbers(phone);//接收短信的手机号码
|
|
|
+ request.setSignName("永天智慧云");//短信签名名称
|
|
|
+ request.setTemplateCode("SMS_164095840");//短信模板CODE
|
|
|
+ request.setTemplateParam("{\"code\":\""+code+"\"}");//短信模板变量对应的实际值
|
|
|
+ try {
|
|
|
+ SendSmsResponse response = client.getAcsResponse(request);
|
|
|
+ System.out.println(new Gson().toJson(response));
|
|
|
+ } catch (ClientException e) {
|
|
|
+ System.out.println("ErrCode:" + e.getErrCode());
|
|
|
+ System.out.println("ErrMsg:" + e.getErrMsg());
|
|
|
+ System.out.println("RequestId:" + e.getRequestId());
|
|
|
+ }
|
|
|
+ return ApiResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|