mirror of
https://gitee.com/dromara/sms4j.git
synced 2025-12-08 01:48:38 +08:00
commit
a31f8a056c
@ -6,6 +6,7 @@ import cn.hutool.core.map.MapUtil;
|
|||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.json.JSONArray;
|
import cn.hutool.json.JSONArray;
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.sms4j.api.entity.SmsResponse;
|
import org.dromara.sms4j.api.entity.SmsResponse;
|
||||||
import org.dromara.sms4j.comm.constant.Constant;
|
import org.dromara.sms4j.comm.constant.Constant;
|
||||||
@ -121,7 +122,14 @@ public class NeteaseSmsImpl extends AbstractSmsBlend<NeteaseConfig> {
|
|||||||
JSONArray jsonArray = new JSONArray();
|
JSONArray jsonArray = new JSONArray();
|
||||||
jsonArray.addAll(phones);
|
jsonArray.addAll(phones);
|
||||||
body.put("mobiles", jsonArray.toString());
|
body.put("mobiles", jsonArray.toString());
|
||||||
|
//保证模板变量参数使用jsonarray传递
|
||||||
|
if (!JSONUtil.isTypeJSONArray(message)) {
|
||||||
|
jsonArray = new JSONArray();
|
||||||
|
jsonArray.add(message);
|
||||||
|
body.put("params", jsonArray.toString());
|
||||||
|
}else {
|
||||||
body.put("params", message);
|
body.put("params", message);
|
||||||
|
}
|
||||||
body.put("needUp", getConfig().getNeedUp());
|
body.put("needUp", getConfig().getNeedUp());
|
||||||
|
|
||||||
Map<String, String> headers = MapUtil.newHashMap(5, true);
|
Map<String, String> headers = MapUtil.newHashMap(5, true);
|
||||||
@ -132,7 +140,7 @@ public class NeteaseSmsImpl extends AbstractSmsBlend<NeteaseConfig> {
|
|||||||
headers.put("CheckSum", checkSum);
|
headers.put("CheckSum", checkSum);
|
||||||
SmsResponse smsResponse;
|
SmsResponse smsResponse;
|
||||||
try {
|
try {
|
||||||
smsResponse = getResponse(http.postJson(requestUrl, headers, body));
|
smsResponse = getResponse(http.postFrom(requestUrl, headers, body));
|
||||||
} catch (SmsBlendException e) {
|
} catch (SmsBlendException e) {
|
||||||
smsResponse = new SmsResponse();
|
smsResponse = new SmsResponse();
|
||||||
smsResponse.setSuccess(false);
|
smsResponse.setSuccess(false);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user