fix:云片NPE异常

This commit is contained in:
daishanling 2023-10-19 16:12:20 +08:00
parent d07676370c
commit 6b6460b9ea

View File

@ -138,8 +138,11 @@ public class YunPianSmsImpl extends AbstractSmsBlend<YunpianConfig> {
body.put("apikey", getConfig().getAccessKeyId()); body.put("apikey", getConfig().getAccessKeyId());
body.put("mobile", phone); body.put("mobile", phone);
body.put("tpl_id", tplId); body.put("tpl_id", tplId);
if (!message.isEmpty()){ //模板中有变量时变量名和变量值都不能为空模板中没有变量时赋值 tpl_value=""
if (message!=null&&!message.isEmpty()){
body.put("tpl_value", formattingMap(message)); body.put("tpl_value", formattingMap(message));
}else {
body.put("tpl_value", "");
} }
if (getConfig().getCallbackUrl() != null && !getConfig().getCallbackUrl().isEmpty()) { if (getConfig().getCallbackUrl() != null && !getConfig().getCallbackUrl().isEmpty()) {
body.put("callback_url", getConfig().getCallbackUrl()); body.put("callback_url", getConfig().getCallbackUrl());