From c3ec0514fcb715e59804b5615d0c9b14abc32265 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E6=B2=90?= Date: Tue, 25 Jun 2024 17:16:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/net/maku/message/sms/SmsContext.java | 35 ---------------------- .../src/main/java/net/maku/sms/SmsContext.java | 35 ++++++++++++++++++++++ 2 files changed, 35 insertions(+), 35 deletions(-) delete mode 100644 maku-boot-module/maku-module-message/src/main/java/net/maku/message/sms/SmsContext.java create mode 100644 maku-boot-system/src/main/java/net/maku/sms/SmsContext.java diff --git a/maku-boot-module/maku-module-message/src/main/java/net/maku/message/sms/SmsContext.java b/maku-boot-module/maku-module-message/src/main/java/net/maku/message/sms/SmsContext.java deleted file mode 100644 index 0958535..0000000 --- a/maku-boot-module/maku-module-message/src/main/java/net/maku/message/sms/SmsContext.java +++ /dev/null @@ -1,35 +0,0 @@ -package net.maku.message.sms; - -import net.maku.framework.common.exception.ServerException; -import net.maku.message.enums.SmsPlatformEnum; -import net.maku.message.sms.config.SmsConfig; - -import java.util.Map; - -/** - * 短信 Context - * - * @author 阿沐 babamu@126.com - * MAKU - */ -public class SmsContext { - private final SmsStrategy smsStrategy; - - public SmsContext(SmsConfig config) { - if (config.getPlatform() == SmsPlatformEnum.ALIYUN.getValue()) { - this.smsStrategy = new AliyunSmsStrategy(config); - } else if (config.getPlatform() == SmsPlatformEnum.TENCENT.getValue()) { - this.smsStrategy = new TencentSmsStrategy(config); - } else if (config.getPlatform() == SmsPlatformEnum.QINIU.getValue()) { - this.smsStrategy = new QiniuSmsStrategy(config); - } else if (config.getPlatform() == SmsPlatformEnum.HUAWEI.getValue()) { - this.smsStrategy = new HuaweiSmsStrategy(config); - } else { - throw new ServerException("未知的短信平台"); - } - } - - public void send(String mobile, Map params) { - smsStrategy.send(mobile, params); - } -} diff --git a/maku-boot-system/src/main/java/net/maku/sms/SmsContext.java b/maku-boot-system/src/main/java/net/maku/sms/SmsContext.java new file mode 100644 index 0000000..5e27dbb --- /dev/null +++ b/maku-boot-system/src/main/java/net/maku/sms/SmsContext.java @@ -0,0 +1,35 @@ +package net.maku.sms; + +import net.maku.framework.common.exception.ServerException; +import net.maku.sms.config.SmsConfig; +import net.maku.system.enums.SmsPlatformEnum; + +import java.util.Map; + +/** + * 短信 Context + * + * @author 阿沐 babamu@126.com + * MAKU + */ +public class SmsContext { + private final SmsStrategy smsStrategy; + + public SmsContext(SmsConfig config) { + if (config.getPlatform() == SmsPlatformEnum.ALIYUN.getValue()) { + this.smsStrategy = new AliyunSmsStrategy(config); + } else if (config.getPlatform() == SmsPlatformEnum.TENCENT.getValue()) { + this.smsStrategy = new TencentSmsStrategy(config); + } else if (config.getPlatform() == SmsPlatformEnum.QINIU.getValue()) { + this.smsStrategy = new QiniuSmsStrategy(config); + } else if (config.getPlatform() == SmsPlatformEnum.HUAWEI.getValue()) { + this.smsStrategy = new HuaweiSmsStrategy(config); + } else { + throw new ServerException("未知的短信平台"); + } + } + + public void send(String mobile, Map params) { + smsStrategy.send(mobile, params); + } +}