适配"高官"敏感词

This commit is contained in:
liuchengqian 2023-06-08 18:18:22 +08:00
parent 3912ec2bd1
commit aee65f190b

View File

@ -14,12 +14,24 @@ import com.tencentcloudapi.sms.v20190711.models.SendSmsResponse;
public class SMSUtils { public class SMSUtils {
public static void main(String[] args) { 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}); int sendSmsToUser = sendSmsToUser(new String[]{"8615764226530"}, "1425995", new String[]{errorMessage});
System.out.println("sendSmsToUser = " + sendSmsToUser); System.out.println("sendSmsToUser = " + sendSmsToUser);
} }
public static int sendSmsToUser(String[] phoneNumbers, String templateId, String[] templateParams) { 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; int resValue = 0;
try { try {
/* 必要步骤 /* 必要步骤