From c9f6494bb40a5a6d008f7366e0e9bbd9e88d4087 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 12 Nov 2022 11:01:15 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E7=9F=AD=E4=BF=A1=E6=A8=A1=E6=9D=BF=E7=9A=84=E6=B8=A0?= =?UTF-8?q?=E9=81=93=E4=B8=BA=E4=BA=91=E7=89=87=E6=97=B6=EF=BC=8C=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=20API=20=E6=A8=A1=E6=9D=BF=E7=BC=96=E5=8F=B7=E4=B8=BA?= =?UTF-8?q?=E6=95=B4=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sms/core/client/impl/yunpian/YunpianSmsClient.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 3cbd07df9..cad5cad2c 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,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 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);