| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- package jnpf.util.message;
- import jnpf.base.SmsModel;
- import org.springframework.stereotype.Component;
- import java.util.List;
- import java.util.Map;
- /**
- * 短信工具类
- *
- * @author JNPF开发平台组
- * @version V3.1.0
- * @copyright 引迈信息技术有限公司(https://www.jnpfsoft.com)
- * @date 2021-12-11
- */
- @Component
- public class SmsUtil {
- /**
- * 获取短信模板参数
- *
- * @param type
- * @param smsModel
- * @param templateId
- * @return
- */
- public static List<String> querySmsTemplateRequest(Integer type, SmsModel smsModel, String endpoint, String region, String templateId) {
- if (type == 1) {
- return SmsAliYunUtil.querySmsTemplateRequest(smsModel.getAliAccessKey(), smsModel.getAliSecret(), endpoint, templateId);
- }
- return SmsTenCentCloudUtil.querySmsTemplateRequest(smsModel.getTencentSecretId(), smsModel.getTencentSecretKey(), endpoint , region, templateId);
- }
- /**
- * 获取短信模板内容
- *
- * @param type
- * @param smsModel
- * @param templateId
- * @return
- */
- public static String querySmsTemplateContent(Integer type, SmsModel smsModel, String endpoint, String region, String templateId) {
- if (type == 1) {
- return SmsAliYunUtil.querySmsTemplateContent(smsModel.getAliAccessKey(), smsModel.getAliSecret(), endpoint, templateId);
- }
- return SmsTenCentCloudUtil.querySmsTemplateContent(smsModel.getTencentSecretId(), smsModel.getTencentSecretKey(), endpoint , region, templateId);
- }
- /**
- * 发送消息
- *
- * @param type
- * @param smsModel
- * @param phoneNumbers
- * @param signContent
- * @param templateId
- * @param map
- * @return
- */
- public static String sentSms(Integer type, SmsModel smsModel, String endpoint, String region, String phoneNumbers, String signContent, String templateId, Map<String, Object> map) {
- if (type == 1) {
- return SmsAliYunUtil.sentSms(smsModel.getAliAccessKey(), smsModel.getAliSecret(), endpoint, phoneNumbers, signContent, templateId, map);
- }
- return SmsTenCentCloudUtil.sentSms(smsModel.getTencentSecretId(), smsModel.getTencentSecretKey(), endpoint, region, phoneNumbers, smsModel.getTencentAppId(), signContent, templateId, map);
- }
- }
|