优化代码

This commit is contained in:
阿沐 2022-08-20 22:39:21 +08:00
parent 29cfc30459
commit a40c0e273d
4 changed files with 79 additions and 79 deletions

View File

@ -18,7 +18,7 @@ public enum SmsPlatformEnum {
/**
* 腾讯云
*/
QCLOUD(1),
TENCENT(1),
/**
* 七牛云
*/

View File

@ -17,8 +17,8 @@ public class SmsContext {
public SmsContext(SmsConfig config) {
if (config.getPlatform() == SmsPlatformEnum.ALIYUN.getValue()) {
this.smsStrategy = new AliyunSmsStrategy(config);
} else if (config.getPlatform() == SmsPlatformEnum.QCLOUD.getValue()) {
this.smsStrategy = new QcloudSmsStrategy(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()) {

View File

@ -5,8 +5,8 @@ import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
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.SendSmsResponse;
import com.tencentcloudapi.sms.v20210111.models.SendStatus;
import net.maku.framework.common.constant.Constant;
import net.maku.framework.common.exception.FastException;
@ -19,11 +19,11 @@ import java.util.Map;
*
* @author 阿沐 babamu@126.com
*/
public class QcloudSmsStrategy implements SmsStrategy {
public class TencentSmsStrategy implements SmsStrategy {
private final SmsConfig smsConfig;
private SmsClient client;
public QcloudSmsStrategy(SmsConfig smsConfig){
public TencentSmsStrategy(SmsConfig smsConfig) {
this.smsConfig = smsConfig;
try {