Commit 11d84b53 authored by hezhen's avatar hezhen

123

parent f5072981
...@@ -195,21 +195,26 @@ public class SmsService { ...@@ -195,21 +195,26 @@ public class SmsService {
try { try {
JSONObject jsonParams=new JSONObject(); JSONObject jsonParams=new JSONObject();
for (int i=0;i<params.length;i++){ for (int i=0;i<params.length;i++){
jsonParams.put(param+(i+1),params[i]); String para=params[i];
if (para.contains("【")){
para=para.replaceAll("【","");
}
if (para.contains("】")){
para=para.replaceAll("】","");
}
jsonParams.put(param+(i+1),para);
} }
sendTemplate(PhoneNumbers,jsonParams.toJSONString(),templateCode); sendTemplate(PhoneNumbers,jsonParams.toJSONString(),templateCode);
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
} }
} }
public static void main(String[] args) throws ClientException, InterruptedException { public static void main(String[] args) throws ClientException, InterruptedException {
SmsService smsService=new SmsService(); SmsService smsService=new SmsService();
//发短信 //发短信
String[] params={"1","2","3","2019-08-29","松山湖"}; String[] params={"1","2","3","2019-08-29","【松山湖】"};
SmsService.sendTemplateToJson("13612688539,13265487972",params,"SMS_169904346"); SmsService.sendTemplateToJson("13612688539,13265487972",params,"SMS_169904346");
/*System.out.println("短信接口返回的数据----------------"); /*System.out.println("短信接口返回的数据----------------");
System.out.println("Code=" + response.getCode()); System.out.println("Code=" + response.getCode());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment