!187 修复luosimao对接手机号+86前缀报错问题

Merge pull request !187 from LiYaoheng/dev-3.0.x
This commit is contained in:
风如歌 2024-12-24 08:25:58 +00:00 committed by Gitee
commit ec501e441d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -1,6 +1,5 @@
package org.dromara.sms4j.luosimao.utils; package org.dromara.sms4j.luosimao.utils;
import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.dromara.sms4j.comm.constant.Constant; import org.dromara.sms4j.comm.constant.Constant;
import org.dromara.sms4j.comm.utils.SmsDateUtils; import org.dromara.sms4j.comm.utils.SmsDateUtils;
@ -21,14 +20,14 @@ public class LuoSiMaoUtils {
public static LinkedHashMap<String, Object> buildBody(String phone, String message) { public static LinkedHashMap<String, Object> buildBody(String phone, String message) {
LinkedHashMap<String, Object> body = new LinkedHashMap<>(2); LinkedHashMap<String, Object> body = new LinkedHashMap<>(2);
body.put("mobile", StrUtil.addPrefixIfNot(phone, "+86")); body.put("mobile", phone);
body.put("message", message); body.put("message", message);
return body; return body;
} }
public static LinkedHashMap<String, Object> buildBody(List<String> phones, String message, Date date) { public static LinkedHashMap<String, Object> buildBody(List<String> phones, String message, Date date) {
LinkedHashMap<String, Object> body = new LinkedHashMap<>(2); LinkedHashMap<String, Object> body = new LinkedHashMap<>(2);
body.put("mobile", SmsUtils.addCodePrefixIfNot(phones)); body.put("mobile", SmsUtils.joinComma(phones));
body.put("message", message); body.put("message", message);
if (date != null) { if (date != null) {
body.put("time", SmsDateUtils.normDatetimeGmt8(date)); body.put("time", SmsDateUtils.normDatetimeGmt8(date));