From 8236ec287f4717dfe87d1ed3496c89e8ae5b8e79 Mon Sep 17 00:00:00 2001 From: "yiwen.lu" Date: Thu, 26 Dec 2024 19:05:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dsubmail=E5=8F=91=E9=80=81?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E5=86=85=E5=AE=B9=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E6=8B=BC=E6=8E=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sms4j/submail/config/SubMailConfig.java | 4 ++-- .../sms4j/submail/service/SubMailSmsImpl.java | 20 +++++++------------ 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/sms4j-provider/src/main/java/org/dromara/sms4j/submail/config/SubMailConfig.java b/sms4j-provider/src/main/java/org/dromara/sms4j/submail/config/SubMailConfig.java index 21dfef1d..632c271d 100644 --- a/sms4j-provider/src/main/java/org/dromara/sms4j/submail/config/SubMailConfig.java +++ b/sms4j-provider/src/main/java/org/dromara/sms4j/submail/config/SubMailConfig.java @@ -36,13 +36,13 @@ public class SubMailConfig extends BaseConfig { /** * MD5 或 SHA-1 默认MD5 填写任意值,不为即为 密匙明文验证模式 */ - private String signType = "MD5"; + private String signType = "md5"; /** * signature加密计算方式 * (当sign_version传2时,会忽略某些字段) */ - private String signVersion; + private String signVersion = "2"; /** * 获取供应商 diff --git a/sms4j-provider/src/main/java/org/dromara/sms4j/submail/service/SubMailSmsImpl.java b/sms4j-provider/src/main/java/org/dromara/sms4j/submail/service/SubMailSmsImpl.java index e577072d..efb85be1 100644 --- a/sms4j-provider/src/main/java/org/dromara/sms4j/submail/service/SubMailSmsImpl.java +++ b/sms4j-provider/src/main/java/org/dromara/sms4j/submail/service/SubMailSmsImpl.java @@ -17,10 +17,7 @@ import org.dromara.sms4j.submail.config.SubMailConfig; import org.dromara.sms4j.submail.utils.SubMailUtils; -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.List; +import java.util.*; import java.util.concurrent.Executor; /** @@ -188,10 +185,9 @@ private LinkedHashMap buildSend(String phone, String content){ body.put("appid", config.getAccessKeyId()); body.put("to", StrUtil.addPrefixIfNot(phone, "+86")); if (StrUtil.isNotBlank(config.getSignature())){ - content = StrUtil.addPrefixIfNot(content, "【 " + config.getSignature() + "】") + StrUtil.sub(content, 0, 1000); - }else { - content = StrUtil.sub(content, 0, 1000); + content = StrUtil.addPrefixIfNot(content, "【 " + config.getSignature() + "】"); } + content = StrUtil.sub(content, 0, 1000); body.put("content", content); body.put("timestamp", timestamp()); body.put("sign_type", config.getSignType()); @@ -244,10 +240,9 @@ private LinkedHashMap buildMultiSend(List phones, String LinkedHashMap body = new LinkedHashMap<>(); body.put("appid", config.getAccessKeyId()); if (StrUtil.isNotBlank(config.getSignature())){ - content = StrUtil.addPrefixIfNot(content, "【 " + config.getSignature() + "】") + StrUtil.sub(content, 0, 1000); - }else { - content = StrUtil.sub(content, 0, 1000); + content = StrUtil.addPrefixIfNot(content, "【 " + config.getSignature() + "】"); } + content = StrUtil.sub(content, 0, 1000); body.put("content", content); phones = CollUtil.sub(phones, 0, 50); List> multi = new ArrayList<>(phones.size()); @@ -316,10 +311,9 @@ private LinkedHashMap buildBatchSend(List phones, String phones = CollUtil.sub(phones, 0, 10000); body.put("to", SmsUtils.addCodePrefixIfNot(phones)); if (StrUtil.isNotBlank(config.getSignature())){ - content = StrUtil.addPrefixIfNot(content, "【 " + config.getSignature() + "】") + StrUtil.sub(content, 0, 1000); - }else { - content = StrUtil.sub(content, 0, 1000); + content = StrUtil.addPrefixIfNot(content, "【 " + config.getSignature() + "】"); } + content = StrUtil.sub(content, 0, 1000); body.put("content", content); body.put("timestamp", timestamp()); body.put("sign_type", config.getSignType());