|
|
|
@@ -1,5 +1,6 @@ |
|
|
|
package com.iformall.sms; |
|
|
|
|
|
|
|
import com.iformall.domain.po.WxMsgConfig; |
|
|
|
import com.iformall.sms.aliyun.AliyunSMS; |
|
|
|
import com.iformall.sms.aliyun.bean.AliyunSMSConfig; |
|
|
|
import com.iformall.sms.wiwide.WiwideUtil; |
|
|
|
@@ -28,28 +29,39 @@ public class SMSFactory { |
|
|
|
smsFactory = this; |
|
|
|
} |
|
|
|
|
|
|
|
private static SMSExcutor getSendExcutor(Integer channel) { |
|
|
|
if(EnumSMSChannel.ALIYUN.getCode().equals(channel)) { |
|
|
|
private static SMSExcutor getSendExcutor(WxMsgConfig wxMsgConfig) { |
|
|
|
if(EnumSMSChannel.ALIYUN.getCode().equals(wxMsgConfig.getSmsChannel())) { |
|
|
|
smsFactory.aliyunSMS.setSmsConfig(smsFactory.smsConfig); |
|
|
|
return smsFactory.aliyunSMS; |
|
|
|
}else if(EnumSMSChannel.ALIYUN_ZDY.getCode().equals(channel)){ |
|
|
|
}else if(EnumSMSChannel.ALIYUN_ZDY.getCode().equals(wxMsgConfig.getSmsChannel())){ |
|
|
|
smsFactory.smsConfig = new AliyunSMSConfig(); |
|
|
|
smsFactory.smsConfig.setAccessKeyId(wxMsgConfig.getPublickey()); |
|
|
|
smsFactory.smsConfig.setAccessKeySecret(wxMsgConfig.getSecret()); |
|
|
|
smsFactory.smsConfig.setProduct(wxMsgConfig.getProduct()); |
|
|
|
smsFactory.smsConfig.setDomain(wxMsgConfig.getDomain()); |
|
|
|
smsFactory.smsConfig.setRegionId(wxMsgConfig.getRegionId()); |
|
|
|
smsFactory.smsConfig.setEndpointName(wxMsgConfig.getEndpointName()); |
|
|
|
smsFactory.aliyunSMS.setSmsConfig(smsFactory.smsConfig); |
|
|
|
return smsFactory.aliyunSMS; |
|
|
|
}else{ |
|
|
|
return smsFactory.wiwide; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public static String sendSms(String secret, String bid, String publickey,String phone, String signature, |
|
|
|
String msg, String notifyUrl, String verifysms, Integer modelId,String templateParam, |
|
|
|
String templateCode, String outId,Integer channel) { |
|
|
|
return getSendExcutor(channel).sendMsg(secret, bid, publickey, phone, signature, msg, notifyUrl, |
|
|
|
public static String sendSms(WxMsgConfig wxMsgConfig,String phone, String signature, String msg, |
|
|
|
String verifysms, Integer modelId, String templateParam, |
|
|
|
String templateCode, String outId) { |
|
|
|
return getSendExcutor(wxMsgConfig).sendMsg(wxMsgConfig.getSecret(), wxMsgConfig.getBid(), wxMsgConfig.getPublickey(), |
|
|
|
phone, signature, msg, wxMsgConfig.getNotifyurl(), |
|
|
|
verifysms, modelId,templateParam,templateCode,outId); |
|
|
|
} |
|
|
|
|
|
|
|
public static String addTemplate(String secret, String bid, String publickey, String signature, String content, |
|
|
|
String notifyUrl, String verifysms,String templateName,Integer templateType, |
|
|
|
String remark,Integer channel) { |
|
|
|
return getSendExcutor(channel).addTemplate(secret, bid, publickey, signature, content, notifyUrl,verifysms, |
|
|
|
templateName,templateType,remark); |
|
|
|
public static String addTemplate(WxMsgConfig wxMsgConfig, String signature, String content, |
|
|
|
String verifysms,String templateName,Integer templateType, |
|
|
|
String remark) { |
|
|
|
return getSendExcutor(wxMsgConfig).addTemplate(wxMsgConfig.getSecret(), wxMsgConfig.getBid(), wxMsgConfig.getPublickey(), |
|
|
|
signature, content, wxMsgConfig.getNotifyurl(), |
|
|
|
verifysms,templateName,templateType,remark); |
|
|
|
} |
|
|
|
|
|
|
|
} |