mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-22 15:05:06 +08:00
1. 阿里云 sms client 增加查询模板的封装
2. 重构阿里云 sms client 客户端,增加 invoke 基础方法
This commit is contained in:
@ -3,8 +3,10 @@ package cn.iocoder.dashboard.framework.sms.core.client.impl.aliyun;
|
||||
import cn.iocoder.dashboard.common.core.KeyValue;
|
||||
import cn.iocoder.dashboard.framework.sms.core.client.SmsCommonResult;
|
||||
import cn.iocoder.dashboard.framework.sms.core.client.dto.SmsSendRespDTO;
|
||||
import cn.iocoder.dashboard.framework.sms.core.client.dto.SmsTemplateRespDTO;
|
||||
import cn.iocoder.dashboard.framework.sms.core.enums.SmsChannelEnum;
|
||||
import cn.iocoder.dashboard.framework.sms.core.property.SmsChannelProperties;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -15,8 +17,10 @@ import java.util.List;
|
||||
*/
|
||||
public class AliyunSmsClientIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testSend() {
|
||||
private static AliyunSmsClient smsClient;
|
||||
|
||||
@BeforeAll
|
||||
public static void before() {
|
||||
// 创建配置类
|
||||
SmsChannelProperties properties = new SmsChannelProperties();
|
||||
properties.setId(1L);
|
||||
@ -25,14 +29,25 @@ public class AliyunSmsClientIntegrationTest {
|
||||
properties.setApiKey(System.getenv("ALIYUN_ACCESS_KEY"));
|
||||
properties.setApiSecret(System.getenv("ALIYUN_SECRET_KEY"));
|
||||
// 创建客户端
|
||||
AliyunSmsClient smsClient = new AliyunSmsClient(properties);
|
||||
smsClient = new AliyunSmsClient(properties);
|
||||
smsClient.init();
|
||||
// 发送短信
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSendSms() {
|
||||
List<KeyValue<String, Object>> templateParams = new ArrayList<>();
|
||||
templateParams.add(new KeyValue<>("code", "1024"));
|
||||
// templateParams.put("operation", "嘿嘿");
|
||||
// SmsResult result = smsClient.send(1L, "15601691399", "4372216", templateParams);
|
||||
SmsCommonResult<SmsSendRespDTO> result = smsClient.sendSms(1L, "15601691399", "SMS_207945135", templateParams);
|
||||
SmsCommonResult<SmsSendRespDTO> result = smsClient.sendSms(1L, "15601691399",
|
||||
"SMS_207945135", templateParams);
|
||||
System.out.println(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSmsTemplate() {
|
||||
String apiTemplateId = "SMS_2079451351";
|
||||
SmsCommonResult<SmsTemplateRespDTO> result = smsClient.getSmsTemplate(apiTemplateId);
|
||||
System.out.println(result);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user