Package org.dromara.sms4j.ctyun.service
Class CtyunSmsImpl
- java.lang.Object
-
- org.dromara.sms4j.provider.service.AbstractSmsBlend<CtyunConfig>
-
- org.dromara.sms4j.ctyun.service.CtyunSmsImpl
-
- All Implemented Interfaces:
SmsBlend
public class CtyunSmsImpl extends AbstractSmsBlend<CtyunConfig>
类名: CtyunSmsImpl
说明: 天翼云短信实现
- Author:
- :bleachtred 2023/5/12 15:06
-
-
Field Summary
Fields Modifier and Type Field Description private int
retry
-
Fields inherited from class org.dromara.sms4j.provider.service.AbstractSmsBlend
delayed, http, pool
-
-
Constructor Summary
Constructors Constructor Description CtyunSmsImpl(CtyunConfig config)
CtyunSmsImpl(CtyunConfig config, Executor pool, DelayedTime delayedTime)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private SmsResponse
getResponse(cn.hutool.json.JSONObject resJson)
private SmsResponse
getSmsResponse(String phone, String message, String templateId)
String
getSupplier()
获取供应商标识SmsResponse
massTexting(List<String> phones, String message)
说明:群发固定模板短信 massTextingSmsResponse
massTexting(List<String> phones, String templateId, LinkedHashMap<String,String> messages)
说明:使用自定义模板群发短信 massTextingprivate SmsResponse
requestRetry(String phone, String message, String templateId)
SmsResponse
sendMessage(String phone, String message)
说明:发送固定消息模板短信SmsResponse
sendMessage(String phone, String templateId, LinkedHashMap<String,String> messages)
说明:使用自定义模板发送短信 sendMessageSmsResponse
sendMessage(String phone, LinkedHashMap<String,String> messages)
sendMessage-
Methods inherited from class org.dromara.sms4j.provider.service.AbstractSmsBlend
delayedMessage, delayedMessage, delayMassTexting, delayMassTexting, errorResp, getConfig, sendMessageAsync, sendMessageAsync, sendMessageAsync, sendMessageAsync
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.dromara.sms4j.api.SmsBlend
batchJoinBlacklist, batchRemovalFromBlacklist, getConfigId, joinInBlacklist, removeFromBlacklist
-
-
-
-
Constructor Detail
-
CtyunSmsImpl
public CtyunSmsImpl(CtyunConfig config, Executor pool, DelayedTime delayedTime)
-
CtyunSmsImpl
public CtyunSmsImpl(CtyunConfig config)
-
-
Method Detail
-
getSupplier
public String getSupplier()
Description copied from interface:SmsBlend
获取供应商标识- Returns:
-
sendMessage
public SmsResponse sendMessage(String phone, String message)
Description copied from class:AbstractSmsBlend
说明:发送固定消息模板短信
此方法将使用配置文件中预设的短信模板进行短信发送
该方法指定的模板变量只能存在一个(配置文件中)
如使用的是腾讯的短信,参数字符串中可以同时存在多个参数,使用 & 分隔例如:您的验证码为{1}在{2}分钟内有效,可以传为 message="xxxx"+"&"+"5" sendMessage
- Specified by:
sendMessage
in interfaceSmsBlend
- Specified by:
sendMessage
in classAbstractSmsBlend<CtyunConfig>
- Parameters:
phone
- 接收短信的手机号 message 消息内容
-
sendMessage
public SmsResponse sendMessage(String phone, LinkedHashMap<String,String> messages)
Description copied from class:AbstractSmsBlend
sendMessage说明:发送固定消息模板多模板参数短信
- Specified by:
sendMessage
in interfaceSmsBlend
- Specified by:
sendMessage
in classAbstractSmsBlend<CtyunConfig>
- Parameters:
phone
- 接收短信的手机号messages
- 模板内容
-
sendMessage
public SmsResponse sendMessage(String phone, String templateId, LinkedHashMap<String,String> messages)
Description copied from class:AbstractSmsBlend
说明:使用自定义模板发送短信 sendMessage
- Specified by:
sendMessage
in interfaceSmsBlend
- Specified by:
sendMessage
in classAbstractSmsBlend<CtyunConfig>
templateId
- 模板idmessages
- key为模板变量名称 value为模板变量值
-
massTexting
public SmsResponse massTexting(List<String> phones, String message)
Description copied from class:AbstractSmsBlend
说明:群发固定模板短信 massTexting
- Specified by:
massTexting
in interfaceSmsBlend
- Specified by:
massTexting
in classAbstractSmsBlend<CtyunConfig>
-
massTexting
public SmsResponse massTexting(List<String> phones, String templateId, LinkedHashMap<String,String> messages)
Description copied from class:AbstractSmsBlend
说明:使用自定义模板群发短信 massTexting
- Specified by:
massTexting
in interfaceSmsBlend
- Specified by:
massTexting
in classAbstractSmsBlend<CtyunConfig>
-
getSmsResponse
private SmsResponse getSmsResponse(String phone, String message, String templateId)
-
requestRetry
private SmsResponse requestRetry(String phone, String message, String templateId)
-
getResponse
private SmsResponse getResponse(cn.hutool.json.JSONObject resJson)
-
-