update 更新 短信演示案例 增加依赖判断与使用说明
This commit is contained in:
parent
5be9ce1823
commit
ae960f5220
@ -34,10 +34,10 @@
|
||||
<!-- <artifactId>dysmsapi20170525</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tencentcloudapi</groupId>
|
||||
<artifactId>tencentcloud-sdk-java</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.tencentcloudapi</groupId>-->
|
||||
<!-- <artifactId>tencentcloud-sdk-java</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
@ -18,6 +18,7 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* 短信演示案例
|
||||
* 请先阅读文档 否则无法使用
|
||||
*
|
||||
* @author Lion Li
|
||||
* @version 4.2.0
|
||||
@ -31,13 +32,17 @@ public class SmsController {
|
||||
|
||||
private final SmsProperties smsProperties;
|
||||
// private final SmsTemplate smsTemplate; // 可以使用spring注入
|
||||
// private final AliyunSmsTemplate smsTemplate; // 也可以注入某个厂家的模板工具
|
||||
|
||||
@ApiOperation("发送短信Aliyun")
|
||||
@GetMapping("/sendAliyun")
|
||||
public R<Object> sendAliyun(@ApiParam("电话号") String phones,
|
||||
@ApiParam("模板ID") String templateId) {
|
||||
if (smsProperties.getEnabled()) {
|
||||
R.fail("当前系统没有开启短信功能!");
|
||||
if (!smsProperties.getEnabled()) {
|
||||
return R.fail("当前系统没有开启短信功能!");
|
||||
}
|
||||
if (!SpringUtils.containsBean("aliyunSmsTemplate")) {
|
||||
return R.fail("阿里云依赖未引入!");
|
||||
}
|
||||
SmsTemplate smsTemplate = SpringUtils.getBean(SmsTemplate.class);
|
||||
Map<String, String> map = new HashMap<>(1);
|
||||
@ -50,8 +55,11 @@ public class SmsController {
|
||||
@GetMapping("/sendTencent")
|
||||
public R<Object> sendTencent(@ApiParam("电话号") String phones,
|
||||
@ApiParam("模板ID") String templateId) {
|
||||
if (smsProperties.getEnabled()) {
|
||||
R.fail("当前系统没有开启短信功能!");
|
||||
if (!smsProperties.getEnabled()) {
|
||||
return R.fail("当前系统没有开启短信功能!");
|
||||
}
|
||||
if (!SpringUtils.containsBean("tencentSmsTemplate")) {
|
||||
return R.fail("腾讯云依赖未引入!");
|
||||
}
|
||||
SmsTemplate smsTemplate = SpringUtils.getBean(SmsTemplate.class);
|
||||
Map<String, String> map = new HashMap<>(1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user