短信配置
短信设置->参数配置,系统默认提供了云通讯、互亿无线两种实现,但不能同时使用,如图
我们配置好了,可以在这直接测试短信是否配置正确
短信模板配置
短信设置->模板配置,如图:
短信发送
短信设置->短信发送,如图:
代码调用
初始化调用服务
@Autowired
private ISmsSendService smsSendService;
发送短信分为同步发送、还是异步队列发送。
/**
*
* @title: sendAsyncSmsByCode
* @description: 通过模版编码发送短信
* @param phone
* @param code
* @param datas
* @return
*/
public void sendAsyncSmsByCode(String phone, String code, String... datas);
/**
*
* @title: sendAsyncSmsByCode
* @description: 通过模版编码发送短信
* @param phone
* @param code
* @param datas
* @return
*/
public void sendAsyncSmsByCode(String phone, String code, SmsHandlerCallBack callBack, String... datas);
/**
*
* @title: sendSyncSmsByCode
* @description: 通过模版编码发送短信
* @param phone
* @param code
* @param datas
* @return
*/
public SmsResult sendSyncSmsByCode(String phone, String code, String... datas);
/**
*
* @title: sendAsyncSmsByContent
* @description: 通过內容异步方式发送短信
* @param phone
* @param code
* @param datas
* @return
*/
public void sendAsyncSmsByContent(String phone, String content, String... datas);
/**
*
* @title: sendAsyncSmsByContent
* @description: 通过內容异步方式发送短信
* @param phone
* @param code
* @param datas
* @return
*/
public void sendAsyncSmsByContent(String phone, String content, SmsHandlerCallBack callBack, String... datas);
/**
*
* @title: sendSyncSmsByContent
* @description: 通过內容同步方式发送短信
* @param phone
* @param code
* @param datas
* @return
*/
public SmsResult sendSyncSmsByContent(String phone, String content, String... datas);
这里有注解,就无需详细说明了。
这样发送之后,我们可以得到发送的短信记录
发送记录