初始化
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package entity
|
||||
|
||||
// 第三方平台
|
||||
type Platform3rdType string
|
||||
|
||||
func (s Platform3rdType) String() string {
|
||||
return string(s)
|
||||
}
|
||||
|
||||
const(
|
||||
Platform3rdTypeAliyun Platform3rdType = "ali" // 阿里云[短信、邮件]
|
||||
Platform3rdTypeTencent Platform3rdType = "tencent" // 腾讯云[短信]
|
||||
)
|
||||
|
||||
|
||||
type SmsTemplateType int
|
||||
|
||||
// 模板类型(0.未知类型 1.验证码 2.短信通知 3.推广短信 4.国际消息 5.数字短信 )
|
||||
const (
|
||||
SmsTemplateTypeUnknown SmsTemplateType = 0 // 未知类型
|
||||
SmsTemplateTypeVerifyCode SmsTemplateType = 1 // 验证码
|
||||
SmsTemplateTypeNotice SmsTemplateType = 2 // 通知短信
|
||||
SmsTemplateTypePromotion SmsTemplateType = 3 // 推广短信
|
||||
SmsTemplateTypeInternational SmsTemplateType = 4 // 国际消息
|
||||
SmsTemplateTypeDigital SmsTemplateType = 5 // 数字短信
|
||||
)
|
||||
|
||||
type SmsTemplateRange int
|
||||
|
||||
const (
|
||||
SmsTemplateRangeUnknown SmsTemplateRange = 0 // 未知类型
|
||||
SmsTemplateRangeGlobal SmsTemplateRange = 1 // 全球/通用场景
|
||||
SmsTemplateRangeChina SmsTemplateRange = 2 // 中国(仅中国大陆)
|
||||
SmsTemplateRangeInternational SmsTemplateRange = 3 // 国际(除中国大陆外)
|
||||
)
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package entity
|
||||
|
||||
type SmsConfig struct {
|
||||
SmsType Platform3rdType `json:"sms_type" gorm:"column:sms_type;not null;comment:短信类型(ali.阿里云 tencent.腾讯云 smsbao.短信宝)"`
|
||||
Name string `json:"name" gorm:"column:name;not null;comment:平台名称"`
|
||||
ConfigData SmsConfigData `json:"config_data" gorm:"column:config_data;serializer:json;not null;comment:配置数据JSON"`
|
||||
Status int8 `json:"status" gorm:"column:status;default:1;comment:通道状态(1.开启 -1关闭)"`
|
||||
}
|
||||
|
||||
type SmsConfigData struct {
|
||||
SysType Platform3rdType `json:"sys_type"` // 短信平台类型
|
||||
Aliyun *SmsConfigDataAliyun `json:"aliyun,omitempty"` // 阿里云短信平台参数
|
||||
Tencent *SmsConfigDataTencent `json:"tencent,omitempty"` // 腾讯云短信平台参数
|
||||
}
|
||||
|
||||
type SmsConfigDataAliyun struct {
|
||||
AccessKeyId string `json:"access_key_id"` // 阿里云短信平台access_key_id
|
||||
AccessKeySecret string `json:"access_key_secret"` // 阿里云短信平台access_key_secret
|
||||
SignName string `json:"sign_name"` // 阿里云短信平台签名
|
||||
Endpoint string `json:"endpoint"` // 选填 阿里云短信平台地址
|
||||
}
|
||||
|
||||
type SmsConfigDataTencent struct {
|
||||
SecretId string `json:"secret_id"` // 腾讯云短信平台secret_id
|
||||
SecretKey string `json:"secret_key"` // 腾讯讯云短信平台secret_key
|
||||
SignName string `json:"sign_name"` // 腾讯云短信平台签名
|
||||
SmsSdkAppId string `json:"sms_sdk_app_id"` // 腾讯云短信平台sdk_app_id
|
||||
Endpoint string `json:"endpoint"` // 选填 腾讯云短信平台地址
|
||||
Region string `json:"region"` // 选填 腾讯云短信平台region
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package entity
|
||||
|
||||
|
||||
type SmsTemplate struct {
|
||||
ConfigId int64 `json:"config_id" gorm:"column:config_id;not null;comment:短信配置ID"`
|
||||
TempId string `json:"temp_id" gorm:"column:temp_id;not null;comment:第三方的模板ID"`
|
||||
TempName string `json:"temp_name" gorm:"column:temp_name;not null;comment:第三方模版名称"`
|
||||
TempType SmsTemplateType `json:"temp_type" gorm:"column:temp_type;not null;comment:模板类型(1.验证码 2.短信通知 3.推广短信 4.国际消息)"`
|
||||
Content string `json:"content" gorm:"column:content;not null;comment:模版发送的值"`
|
||||
TempStatus SmsTemplateStatus `json:"temp_status" gorm:"column:temp_status;not null;comment:模板的状态(1.通过审核 2.审核中)"`
|
||||
Params []SmsTemplateParam `json:"params" gorm:"column:params;serializer:json;comment:模板的参数"` // json类型存储
|
||||
Remark string `json:"remark" gorm:"column:remark;type:varchar(1000);comment:备注"` // 备注
|
||||
ParamsStatus SmsTemplateParamStatus `json:"params_status" gorm:"column:params_status;default:2;comment:参数校验状态(1.正常 2.待校验)"`
|
||||
DataType SmsTemplateDataType `json:"data_type" gorm:"column:data_type;not null;comment:数据类型(1.自动同步 2.手动加入)"` // 1: 自动同步 2: 手动加入
|
||||
TempRange SmsTemplateRange `json:"temp_range" gorm:"column:temp_range;default:0;comment:作用地区(0.未知地区 1.全球 2.仅中国大陆 3.国际及港澳台)"` // 0: 未知地区 1: 全球 2: 仅中国大陆 3: 国际及港���
|
||||
}
|
||||
|
||||
type SmsTemplateParam struct {
|
||||
FieldName string `json:"field_name" binding:"required"` // 第三方平台字段
|
||||
// FieldType consts.SmsFieldType `json:"field_type" binding:"required"` // 内部对应对应类型
|
||||
}
|
||||
|
||||
type SmsTemplateStatus int8
|
||||
|
||||
// (0.未知状态 1.通过审核 2.审核中 3.未通过审核 4.取消审核)
|
||||
const (
|
||||
SmsTemplateStatusUnknown SmsTemplateStatus = 0
|
||||
SmsTemplateStatusPass SmsTemplateStatus = 1
|
||||
SmsTemplateStatusAudit SmsTemplateStatus = 2
|
||||
SmsTemplateStatusUnPass SmsTemplateStatus = 3
|
||||
SmsTemplateStatusCancel SmsTemplateStatus = 4
|
||||
)
|
||||
|
||||
type SmsTemplateParamStatus int8
|
||||
|
||||
const (
|
||||
SmsTemplateParamStatusNormal SmsTemplateParamStatus = 1
|
||||
SmsTemplateParamStatusWait SmsTemplateParamStatus = 2
|
||||
)
|
||||
|
||||
type SmsTemplateDataType int8
|
||||
|
||||
const (
|
||||
SmsTemplateDataTypeAutoSync SmsTemplateDataType = 1 // 自动同步
|
||||
SmsTemplateDataTypeManual SmsTemplateDataType = 2 // 手动加入的模板,需要人工审核和加入到库中
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user