|
@@ -30,8 +30,8 @@ public class SendSmsUtils {
|
|
|
/**
|
|
|
* TODO 此处需要替换成开发者自己的AK(在阿里云访问控制台寻找)
|
|
|
*/
|
|
|
- static final String ACCESS_KEY_ID = "";
|
|
|
- static final String ACCESS_KEY_SECRET = "";
|
|
|
+ static final String ACCESS_KEY_ID = "LTAI5tNA2fcBJH6EWRH6Pxr6";
|
|
|
+ static final String ACCESS_KEY_SECRET = "5WdaPEOvC3u9LC7pwy2DQ9pgmJvgUr";
|
|
|
|
|
|
/**
|
|
|
* 发送短信接口
|
|
@@ -39,7 +39,7 @@ public class SendSmsUtils {
|
|
|
* @return
|
|
|
* @throws ClientException
|
|
|
*/
|
|
|
- public static SendSmsResponse sendSms(String phone) throws ClientException {
|
|
|
+ public static SendSmsResponse sendSms(String phone,String remark ) throws ClientException {
|
|
|
//可自助调整超时时间
|
|
|
System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
|
|
|
System.setProperty("sun.net.client.defaultReadTimeout", "10000");
|
|
@@ -54,11 +54,11 @@ public class SendSmsUtils {
|
|
|
//必填:待发送手机号 多个手机号用逗号分割
|
|
|
request.setPhoneNumbers(phone);
|
|
|
//必填:短信签名-可在短信控制台中找到
|
|
|
- request.setSignName("");
|
|
|
+ request.setSignName("安徽博曼网络科技有限公司");
|
|
|
//必填:短信模板-可在短信控制台中找到
|
|
|
- request.setTemplateCode("");
|
|
|
+ request.setTemplateCode("SMS_219525380");
|
|
|
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
|
|
|
- request.setTemplateParam("{\"name\":\"Tom\", \"code\":\"123\"}");
|
|
|
+ request.setTemplateParam("{\"remark\":\"" + remark + "\"}");
|
|
|
//可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
|
|
|
request.setOutId("zhaoShang");
|
|
|
|
|
@@ -66,6 +66,7 @@ public class SendSmsUtils {
|
|
|
SendSmsResponse sendSmsResponse = null;
|
|
|
try {
|
|
|
sendSmsResponse = acsClient.getAcsResponse(request);
|
|
|
+ System.out.println(sendSmsResponse.getMessage());
|
|
|
} catch (ClientException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|