Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复submail发送自定义内容重复拼接的问题 #33

Open
wants to merge 1 commit into
base: dev-3.0.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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";

/**
* 获取供应商
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -188,10 +185,9 @@ private LinkedHashMap<String, Object> 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());
Expand Down Expand Up @@ -244,10 +240,9 @@ private LinkedHashMap<String, Object> buildMultiSend(List<String> phones, String
LinkedHashMap<String, Object> 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<LinkedHashMap<String, Object>> multi = new ArrayList<>(phones.size());
Expand Down Expand Up @@ -316,10 +311,9 @@ private LinkedHashMap<String, Object> buildBatchSend(List<String> 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());
Expand Down