@Test public void singleSendTest() { String sign = "阿里云短信测试专用"; String mobile = "13302926050"; String templateCode = "SMS_137110043"; String template = "验证码#code#，您正在进行身份验证，打死不要告诉别人哦！"; smsAliYunClient.singleSend(mobile, sign, templateCode, template, ImmutableMap.of("code", "8888")); }
@Override public SendResult singleSend(String mobile, String sign, String templateCode, String template, Map<String, String> templateParams) { CommonRequest request = new CommonRequest(); request.setMethod(MethodType.POST); request.setDomain(DOMAIN); request.setVersion("2017-05-25"); request.setAction("SendSms"); request.putQueryParameter("PhoneNumbers", mobile); request.putQueryParameter("SignName", sign); request.putQueryParameter("TemplateCode", templateCode); request.putQueryParameter("TemplateParam", JSON.toJSONString(templateParams)); return doSend(request); }
SmsAliYunClient implements SmsClient { @Override public SendResult singleSend(String mobile, String sign, String templateCode, String template, Map<String, String> templateParams) { CommonRequest request = new CommonRequest(); request.setMethod(MethodType.POST); request.setDomain(DOMAIN); request.setVersion("2017-05-25"); request.setAction("SendSms"); request.putQueryParameter("PhoneNumbers", mobile); request.putQueryParameter("SignName", sign); request.putQueryParameter("TemplateCode", templateCode); request.putQueryParameter("TemplateParam", JSON.toJSONString(templateParams)); return doSend(request); } }
SmsAliYunClient implements SmsClient { @Override public SendResult singleSend(String mobile, String sign, String templateCode, String template, Map<String, String> templateParams) { CommonRequest request = new CommonRequest(); request.setMethod(MethodType.POST); request.setDomain(DOMAIN); request.setVersion("2017-05-25"); request.setAction("SendSms"); request.putQueryParameter("PhoneNumbers", mobile); request.putQueryParameter("SignName", sign); request.putQueryParameter("TemplateCode", templateCode); request.putQueryParameter("TemplateParam", JSON.toJSONString(templateParams)); return doSend(request); }  }
SmsAliYunClient implements SmsClient { @Override public SendResult singleSend(String mobile, String sign, String templateCode, String template, Map<String, String> templateParams) { CommonRequest request = new CommonRequest(); request.setMethod(MethodType.POST); request.setDomain(DOMAIN); request.setVersion("2017-05-25"); request.setAction("SendSms"); request.putQueryParameter("PhoneNumbers", mobile); request.putQueryParameter("SignName", sign); request.putQueryParameter("TemplateCode", templateCode); request.putQueryParameter("TemplateParam", JSON.toJSONString(templateParams)); return doSend(request); }  @Override SendResult singleSend(String mobile, String sign, String templateCode,
                                 String template, Map<String, String> templateParams); @Override SendResult batchSend(List<String> mobileList, String sign, String templateCode,
                                String template, Map<String, String> templateParams); }
SmsAliYunClient implements SmsClient { @Override public SendResult singleSend(String mobile, String sign, String templateCode, String template, Map<String, String> templateParams) { CommonRequest request = new CommonRequest(); request.setMethod(MethodType.POST); request.setDomain(DOMAIN); request.setVersion("2017-05-25"); request.setAction("SendSms"); request.putQueryParameter("PhoneNumbers", mobile); request.putQueryParameter("SignName", sign); request.putQueryParameter("TemplateCode", templateCode); request.putQueryParameter("TemplateParam", JSON.toJSONString(templateParams)); return doSend(request); }  @Override SendResult singleSend(String mobile, String sign, String templateCode,
                                 String template, Map<String, String> templateParams); @Override SendResult batchSend(List<String> mobileList, String sign, String templateCode,
                                String template, Map<String, String> templateParams);  }