优化代码
This commit is contained in:
parent
29cfc30459
commit
a40c0e273d
|
@ -18,7 +18,7 @@ public enum SmsPlatformEnum {
|
||||||
/**
|
/**
|
||||||
* 腾讯云
|
* 腾讯云
|
||||||
*/
|
*/
|
||||||
QCLOUD(1),
|
TENCENT(1),
|
||||||
/**
|
/**
|
||||||
* 七牛云
|
* 七牛云
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -17,8 +17,8 @@ public class SmsContext {
|
||||||
public SmsContext(SmsConfig config) {
|
public SmsContext(SmsConfig config) {
|
||||||
if (config.getPlatform() == SmsPlatformEnum.ALIYUN.getValue()) {
|
if (config.getPlatform() == SmsPlatformEnum.ALIYUN.getValue()) {
|
||||||
this.smsStrategy = new AliyunSmsStrategy(config);
|
this.smsStrategy = new AliyunSmsStrategy(config);
|
||||||
} else if (config.getPlatform() == SmsPlatformEnum.QCLOUD.getValue()) {
|
} else if (config.getPlatform() == SmsPlatformEnum.TENCENT.getValue()) {
|
||||||
this.smsStrategy = new QcloudSmsStrategy(config);
|
this.smsStrategy = new TencentSmsStrategy(config);
|
||||||
} else if (config.getPlatform() == SmsPlatformEnum.QINIU.getValue()) {
|
} else if (config.getPlatform() == SmsPlatformEnum.QINIU.getValue()) {
|
||||||
this.smsStrategy = new QiniuSmsStrategy(config);
|
this.smsStrategy = new QiniuSmsStrategy(config);
|
||||||
} else if (config.getPlatform() == SmsPlatformEnum.HUAWEI.getValue()) {
|
} else if (config.getPlatform() == SmsPlatformEnum.HUAWEI.getValue()) {
|
||||||
|
|
|
@ -5,8 +5,8 @@ import com.tencentcloudapi.common.Credential;
|
||||||
import com.tencentcloudapi.common.profile.ClientProfile;
|
import com.tencentcloudapi.common.profile.ClientProfile;
|
||||||
import com.tencentcloudapi.common.profile.HttpProfile;
|
import com.tencentcloudapi.common.profile.HttpProfile;
|
||||||
import com.tencentcloudapi.sms.v20210111.SmsClient;
|
import com.tencentcloudapi.sms.v20210111.SmsClient;
|
||||||
import com.tencentcloudapi.sms.v20210111.models.SendSmsResponse;
|
|
||||||
import com.tencentcloudapi.sms.v20210111.models.SendSmsRequest;
|
import com.tencentcloudapi.sms.v20210111.models.SendSmsRequest;
|
||||||
|
import com.tencentcloudapi.sms.v20210111.models.SendSmsResponse;
|
||||||
import com.tencentcloudapi.sms.v20210111.models.SendStatus;
|
import com.tencentcloudapi.sms.v20210111.models.SendStatus;
|
||||||
import net.maku.framework.common.constant.Constant;
|
import net.maku.framework.common.constant.Constant;
|
||||||
import net.maku.framework.common.exception.FastException;
|
import net.maku.framework.common.exception.FastException;
|
||||||
|
@ -19,11 +19,11 @@ import java.util.Map;
|
||||||
*
|
*
|
||||||
* @author 阿沐 babamu@126.com
|
* @author 阿沐 babamu@126.com
|
||||||
*/
|
*/
|
||||||
public class QcloudSmsStrategy implements SmsStrategy {
|
public class TencentSmsStrategy implements SmsStrategy {
|
||||||
private final SmsConfig smsConfig;
|
private final SmsConfig smsConfig;
|
||||||
private SmsClient client;
|
private SmsClient client;
|
||||||
|
|
||||||
public QcloudSmsStrategy(SmsConfig smsConfig){
|
public TencentSmsStrategy(SmsConfig smsConfig) {
|
||||||
this.smsConfig = smsConfig;
|
this.smsConfig = smsConfig;
|
||||||
|
|
||||||
try {
|
try {
|
Loading…
Reference in New Issue
Block a user