- 各短信平台兼容问题,放弃 sign 和 template 模板审核过程

- 增加短信类型
- 云片ok
- 阿里云 未完成
This commit is contained in:
sin-ning@aliyun.com
2019-05-25 16:55:09 +08:00
parent e8e4a4781c
commit 74724637b7
20 changed files with 762 additions and 646 deletions

View File

@@ -1,116 +0,0 @@
package cn.iocoder.mall.admin.api;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
/**
* 短信平台
*
* @author Sin
* @time 2019/5/16 6:33 PM
*/
public interface SmsPlatform {
@Data
@Accessors(chain = true)
class Result {
/**
* 编号
*/
private String id;
/**
* 审核状态
*/
private Integer applyStatus;
/**
* 审核内容
*/
private String applyMessage;
}
/**
* 签名 - 创建
*
* @param sign
*/
Result createSign(String sign);
/**
* 签名 - 获取
*
* @param sign
*/
Result getSign(String sign);
/**
* 签名 - 更新
*
* @param oldSign
* @param sign
*/
Result updateSign(String oldSign, String sign);
/**
* 模板 - 创建
*
* @param template 模板内容
* @param tplType 1 为验证码类型,其他为 null
*/
Result createTemplate(String template, Integer tplType);
/**
* 模板 - 获取
*
* @param tplId
*/
Result getTemplate(String tplId);
/**
* 模板 - 更新
*
* @param tplId 选用的哪个签名
* @param template 模板内容
* @param tplType 1 为验证码类型,其他为 null
*/
Result updateTemplate(String tplId, String template, Integer tplType);
/**
* 模板 - 删除
*
* @param tplId
* @return
*/
Result deleteTemplate(String tplId);
@Data
@Accessors(chain = true)
class SendResult {
private Boolean hasSuccess;
private Integer code;
private String message;
private List<String> success;
private List<String> fail;
}
/**
* 短信发送 - 单个
*
* @return
*/
SendResult singleSend(String mobile, String template);
/**
* 短信发送 - 批量
*
* @return
*/
SendResult batchSend(List<String> mobileList, String template);
}

View File

@@ -39,47 +39,56 @@ public interface SmsService {
*
* @param sign
*/
void createSign(String sign);
void createSign(String sign, Integer platform);
/**
* 签名 - 获取
*
* @param sign
* @param id
*/
SmsSignBO getSign(String sign);
SmsSignBO getSign(Integer id);
/**
* 签名 - 更新
*
* @param oldSign
* @param sign
* @param id
* @param newSign
* @param platform
*/
void updateSign(String oldSign, String sign);
void updateSign(Integer id, String newSign, Integer platform);
/**
* 签名 - 更新
*
* @param id
*/
void deleteSign(Integer id);
/**
* 模板 - 创建
*
* @param smsSignId 选用的哪个签名
* @param template 模板内容
* @param tplType 1 为验证码类型,其他为 null
* @param platform 平台
*/
void createTemplate(Integer smsSignId, String template, Integer tplType);
void createTemplate(Integer smsSignId, String template, Integer platform, Integer smsType);
/**
* 模板 - 获取
*
* @param id
*/
SmsTemplateBO getTemplate(Integer id);
SmsTemplateBO getTemplate(Integer id, Integer platform);
/**
* 模板 - 更新
*
* @param id 模板id
* @param smsSignId 短期签名
* @param template 模板内容
* @param tplType 1 为验证码类型,其他为 null
* @param platform 短信平台
*/
void updateTemplate(Integer id, String template, Integer tplType);
void updateTemplate(Integer id, Integer smsSignId, String template, Integer platform, Integer smsType);
/**
* 模板 - 删除

View File

@@ -56,6 +56,7 @@ public enum AdminErrorCodeEnum {
SMS_SIGN_IS_EXISTENT(1002006002, "短信签名已存在"),
SMS_TEMPLATE_NOT_EXISTENT(1002006020, "短信签名不存在"),
SMS_TEMPLATE_IS_EXISTENT(1002006021, "短信签名不存在"),
SMS_NOT_SEND_CLIENT(1002006030, "短信没有发送的client"),
;
private final int code;

View File

@@ -0,0 +1,11 @@
package cn.iocoder.mall.admin.api.constant;
/**
* 字典 key
*
* @author Sin
* @time 2019/5/25 3:36 PM
*/
public class DictKeyConstants {
}

View File

@@ -13,19 +13,19 @@ public enum SmsApplyStatusEnum {
FAIL(3, "审核失败"),
;
private final int code;
private final String message;
private final Integer value;
private final String name;
SmsApplyStatusEnum(int code, String message) {
this.code = code;
this.message = message;
this.value = code;
this.name = message;
}
public int getCode() {
return code;
public int getValue() {
return value;
}
public String getMessage() {
return message;
public String getName() {
return name;
}
}

View File

@@ -0,0 +1,30 @@
package cn.iocoder.mall.admin.api.constant;
/**
* 短信审核状态
*
* @author Sin
* @time 2019/5/16 12:48 PM
*/
public enum SmsPlatformEnum {
YunPian(1, "云片"),
AliYun(2, "阿里云"),
;
private final Integer value;
private final String name;
SmsPlatformEnum(Integer code, String message) {
this.value = code;
this.name = message;
}
public Integer getValue() {
return value;
}
public String getName() {
return name;
}
}

View File

@@ -0,0 +1,31 @@
package cn.iocoder.mall.admin.api.constant;
/**
* 短信审核状态
*
* @author Sin
* @time 2019/5/16 12:48 PM
*/
public enum SmsTypeEnum {
VERIFICATION_CODE(1, "验证码"),
NOTICE(1, "通知"),
MARKETING(2, "营销"),
;
private final Integer value;
private final String name;
SmsTypeEnum(Integer code, String message) {
this.value = code;
this.name = message;
}
public Integer getValue() {
return value;
}
public String getName() {
return name;
}
}