短信验证码模版+签名使用不对的问题

This commit is contained in:
kuang.yife 2023-05-16 10:48:03 +08:00
parent fe64a32608
commit aea8f82331
1 changed files with 4 additions and 2 deletions

View File

@ -11,6 +11,7 @@ import com.ruoyi.common.utils.ExceptionUtil;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.NoticeRequest;
import lombok.extern.slf4j.Slf4j;
import net.bytebuddy.asm.Advice;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -39,8 +40,8 @@ public class NoticeController {
// 工程代码泄露可能会导致AccessKey泄露并威胁账号下所有资源的安全性以下代码示例仅供参考建议使用更安全的 STS 方式更多鉴权访问方式请参见https://help.aliyun.com/document_detail/378657.html
Client client = createClient("LTAI5tLDuQRdfyHASSxehs9m", "CraRUliWZNMJhhSRIZ0nVWrxFkGTOH");
SendSmsRequest sendSmsRequest = new SendSmsRequest()
.setSignName("保无忧")
.setTemplateCode("SMS_275375715")
.setSignName("保无忧法律咨询")
.setTemplateCode("SMS_268511098")
.setPhoneNumbers(request.getPhone())
.setTemplateParam("{\"code\":"+ code +"}");
RuntimeOptions runtime = new RuntimeOptions();
@ -50,6 +51,7 @@ public class NoticeController {
CacheUtils.put(request.getPhone(), code);
}catch (Exception e){
log.error("给 {} 发送短信失败 {}", request.getPhone(), ExceptionUtil.getExceptionMessage(e));
return AjaxResult.error(e.getMessage());
}
return AjaxResult.success("操作成功!");
}