From aee65f190bb8a64562c17aeb5d68d365e0ff5fea Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Thu, 8 Jun 2023 18:18:22 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8D"=E9=AB=98=E5=AE=98"=E6=95=8F?= =?UTF-8?q?=E6=84=9F=E8=AF=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/xkrs/utilsnew/SMSUtils.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 { /* 必要步骤: