【优化】修改短信模板的渠道为云片时,校验 API 模板编号为整数
This commit is contained in:
parent
4b92663b5e
commit
c33db3e60c
@ -2,6 +2,7 @@ package cn.iocoder.yudao.framework.sms.core.client.impl.yunpian;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.core.util.URLUtil;
|
import cn.hutool.core.util.URLUtil;
|
||||||
import cn.iocoder.yudao.framework.common.core.KeyValue;
|
import cn.iocoder.yudao.framework.common.core.KeyValue;
|
||||||
@ -105,6 +106,9 @@ public class YunpianSmsClient extends AbstractSmsClient {
|
|||||||
@Override
|
@Override
|
||||||
protected SmsCommonResult<SmsTemplateRespDTO> doGetSmsTemplate(String apiTemplateId) throws Throwable {
|
protected SmsCommonResult<SmsTemplateRespDTO> doGetSmsTemplate(String apiTemplateId) throws Throwable {
|
||||||
return invoke(() -> {
|
return invoke(() -> {
|
||||||
|
if (!NumberUtil.isNumber(apiTemplateId)) {
|
||||||
|
throw new IllegalArgumentException("云片的 API 模板编号必须为整数");
|
||||||
|
}
|
||||||
Map<String, String> request = new HashMap<>();
|
Map<String, String> request = new HashMap<>();
|
||||||
request.put(YunpianConstant.APIKEY, properties.getApiKey());
|
request.put(YunpianConstant.APIKEY, properties.getApiKey());
|
||||||
request.put(YunpianConstant.TPL_ID, apiTemplateId);
|
request.put(YunpianConstant.TPL_ID, apiTemplateId);
|
||||||
@ -112,7 +116,7 @@ public class YunpianSmsClient extends AbstractSmsClient {
|
|||||||
}, response -> {
|
}, response -> {
|
||||||
Template template = response.get(0);
|
Template template = response.get(0);
|
||||||
return new SmsTemplateRespDTO().setId(String.valueOf(template.getTpl_id())).setContent(template.getTpl_content())
|
return new SmsTemplateRespDTO().setId(String.valueOf(template.getTpl_id())).setContent(template.getTpl_content())
|
||||||
.setAuditStatus(convertSmsTemplateAuditStatus(template.getCheck_status())).setAuditReason(template.getReason());
|
.setAuditStatus(convertSmsTemplateAuditStatus(template.getCheck_status())).setAuditReason(template.getReason());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user