【优化】修改短信模板的渠道为云片时,校验 API 模板编号为整数
This commit is contained in:
parent
ae0227c107
commit
c9f6494bb4
@ -2,9 +2,11 @@ package cn.iocoder.yudao.framework.sms.core.client.impl.yunpian;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.URLUtil;
|
||||
import cn.iocoder.yudao.framework.common.core.KeyValue;
|
||||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||
import cn.iocoder.yudao.framework.sms.core.client.SmsCommonResult;
|
||||
import cn.iocoder.yudao.framework.sms.core.client.dto.SmsReceiveRespDTO;
|
||||
import cn.iocoder.yudao.framework.sms.core.client.dto.SmsSendRespDTO;
|
||||
@ -12,7 +14,6 @@ import cn.iocoder.yudao.framework.sms.core.client.dto.SmsTemplateRespDTO;
|
||||
import cn.iocoder.yudao.framework.sms.core.client.impl.AbstractSmsClient;
|
||||
import cn.iocoder.yudao.framework.sms.core.enums.SmsTemplateAuditStatusEnum;
|
||||
import cn.iocoder.yudao.framework.sms.core.property.SmsChannelProperties;
|
||||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
@ -105,6 +106,9 @@ public class YunpianSmsClient extends AbstractSmsClient {
|
||||
@Override
|
||||
protected SmsCommonResult<SmsTemplateRespDTO> doGetSmsTemplate(String apiTemplateId) throws Throwable {
|
||||
return invoke(() -> {
|
||||
if (!NumberUtil.isNumber(apiTemplateId)) {
|
||||
throw new IllegalArgumentException("云片的 API 模板编号必须为整数");
|
||||
}
|
||||
Map<String, String> request = new HashMap<>();
|
||||
request.put(YunpianConstant.APIKEY, properties.getApiKey());
|
||||
request.put(YunpianConstant.TPL_ID, apiTemplateId);
|
||||
|
Loading…
Reference in New Issue
Block a user