diff --git a/src/main/java/com/xkrs/utilsnew/SMSUtils.java b/src/main/java/com/xkrs/utilsnew/SMSUtils.java index 117268f..d74e609 100644 --- a/src/main/java/com/xkrs/utilsnew/SMSUtils.java +++ b/src/main/java/com/xkrs/utilsnew/SMSUtils.java @@ -14,12 +14,24 @@ import com.tencentcloudapi.sms.v20190711.models.SendSmsResponse; public class SMSUtils { public static void main(String[] args) { - String errorMessage = "星科瑞升-秸秆火后台系统报错-检查火点卫星时间是否在精准渠道配置时间范围内-数据库配置项-时间列表-为null或size=0-火点编码=20230201021511011713127"; + String errorMessage = "星科瑞升-秸秆火后台系统报错-检查火点卫星时间是否在精准渠道配置时高官据库配置项-时间列表-为null或s1713127"; int sendSmsToUser = sendSmsToUser(new String[]{"8615764226530"}, "1425995", new String[]{errorMessage}); System.out.println("sendSmsToUser = " + sendSmsToUser); } public static int sendSmsToUser(String[] phoneNumbers, String templateId, String[] templateParams) { + String[] newTemplateParams = new String[templateParams.length]; + for (int i = 0; i < templateParams.length; i++) { + if (templateParams[i].contains("高官")) { + newTemplateParams[i] = templateParams[i].replace("高官", "高/官"); + } else { + newTemplateParams[i] = templateParams[i]; + } + } + return realSendSmsToUser(phoneNumbers, templateId, newTemplateParams); + } + + public static int realSendSmsToUser(String[] phoneNumbers, String templateId, String[] templateParams) { int resValue = 0; try { /* 必要步骤: