diff --git a/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/yunpian/YunpianSmsClient.java b/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/yunpian/YunpianSmsClient.java index c5d1f88d0..3b3588a2d 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/yunpian/YunpianSmsClient.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/yunpian/YunpianSmsClient.java @@ -2,6 +2,7 @@ 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; @@ -105,6 +106,9 @@ public class YunpianSmsClient extends AbstractSmsClient { @Override protected SmsCommonResult doGetSmsTemplate(String apiTemplateId) throws Throwable { return invoke(() -> { + if (!NumberUtil.isNumber(apiTemplateId)) { + throw new IllegalArgumentException("云片的 API 模板编号必须为整数"); + } Map request = new HashMap<>(); request.put(YunpianConstant.APIKEY, properties.getApiKey()); request.put(YunpianConstant.TPL_ID, apiTemplateId); @@ -112,7 +116,7 @@ public class YunpianSmsClient extends AbstractSmsClient { }, response -> { Template template = response.get(0); 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()); }); }