|
@@ -0,0 +1,77 @@
|
|
1
|
+package models
|
|
2
|
+
|
|
3
|
+type SMSTemplate struct {
|
|
4
|
+ ID int64 `gorm:"column:id"`
|
|
5
|
+ TemplateType int8 `gorm:"column:template_type"` // 模板类型 1.默认模板 2.自定义模板
|
|
6
|
+ TemplateID int64 `gorm:"column:template_id"` // 短信平台上的模板 id
|
|
7
|
+ MessageType int8 `gorm:"column:message_type"` // 短信类型 1.通知短信、2.服务短信 3.验证码短信
|
|
8
|
+ Content string // 模板内容
|
|
9
|
+ ParamTypes string `gorm:"column:param_types"` // 模板内容里的参数类型:1,2,3 。参数类型以逗号隔开,位置代表了参数‘{n+1}’,类型暂时有:1.用户名 2.商家简称 3.链接 4.商品名称 5.活动名称 6.验证码。(自定义模板是没有值的,因为它没有参数)
|
|
10
|
+ Autograph string // 短信签名
|
|
11
|
+ OrgID int64 `gorm:"column:org_id"` // 模板所属机构(自定义模板才有值)
|
|
12
|
+ Status int8 // 模板状态 0.无效 1.有效 2.审核中
|
|
13
|
+ CreateTime int64 `gorm:"column:ctime"` // 创建时间
|
|
14
|
+ ModifyTime int64 `gorm:"column:mtime"` // 修改时间
|
|
15
|
+}
|
|
16
|
+
|
|
17
|
+func (SMSTemplate) TableName() string {
|
|
18
|
+ return "sgj_patient_sms_template"
|
|
19
|
+}
|
|
20
|
+
|
|
21
|
+type UserSMSFreeLimit struct {
|
|
22
|
+ ID int64 `gorm:"column:id"`
|
|
23
|
+ OrgID int64 `gorm:"column:org_id"` // 机构 ID
|
|
24
|
+ TotalCount int `gorm:"column:total_count"` // 免费额度,单位:条,下同
|
|
25
|
+ UsedCount int `gorm:"column:used_count"` // 已用额度
|
|
26
|
+ ValidMonth string `gorm:"column:valid_month"` // 生效月份,格式:201804
|
|
27
|
+ Status int8 // 状态 0.无效 1.有效
|
|
28
|
+ CreateTime int64 `gorm:"column:ctime"` // 创建时间
|
|
29
|
+ ModifyTime int64 `gorm:"column:mtime"` // 修改时间
|
|
30
|
+}
|
|
31
|
+
|
|
32
|
+func (UserSMSFreeLimit) TableName() string {
|
|
33
|
+ return "sgj_patient_user_sms_free_limit"
|
|
34
|
+}
|
|
35
|
+
|
|
36
|
+type SMSBatch struct {
|
|
37
|
+ ID int64 `gorm:"column:id"`
|
|
38
|
+ OrgID int64 `gorm:"column:org_id"` // 机构 ID
|
|
39
|
+ TemplateID int64 `gorm:"column:sms_template_id"` // 对应短信平台上的模板 ID
|
|
40
|
+ Autograph string // 短信签名
|
|
41
|
+ Params string // 模板参数,以“,”隔开
|
|
42
|
+ FullContent string `gorm:"column:full_content"` // 完整短信内容
|
|
43
|
+ Mobiles string // 接收手机号,以“,”隔开
|
|
44
|
+ SendTime int64 `gorm:"column:send_time"` // 发送时间
|
|
45
|
+ Status int8 // 状态: 1.待审核 2.审核未通过 3.未发送 4.已发送 5.发送失败
|
|
46
|
+ CreateTime int64 `gorm:"column:ctime"` // 创建时间
|
|
47
|
+ ModifyTime int64 `gorm:"column:mtime"` // 修改时间
|
|
48
|
+}
|
|
49
|
+
|
|
50
|
+func (SMSBatch) TableName() string {
|
|
51
|
+ return "sgj_patient_sms_batch"
|
|
52
|
+}
|
|
53
|
+
|
|
54
|
+type SMSSendStatus struct {
|
|
55
|
+ ID int64 `gorm:"column:id"`
|
|
56
|
+ BatchID int64 `gorm:"batch_id"` // 批次 ID,对应 SMSBatch.ID
|
|
57
|
+ Mobile string // 接收手机号
|
|
58
|
+ Status int8 // 发送结果状态: 0.失败 1.成功
|
|
59
|
+ Code string // 短信平台返回的错误码
|
|
60
|
+ Msg string // 短信平台返回的错误信息
|
|
61
|
+ CreateTime int64 `gorm:"column:ctime"` // 创建时间
|
|
62
|
+ ModifyTime int64 `gorm:"column:mtime"` // 修改时间
|
|
63
|
+}
|
|
64
|
+
|
|
65
|
+func (SMSSendStatus) TableName() string {
|
|
66
|
+ return "sgj_patient_sms_send_status"
|
|
67
|
+}
|
|
68
|
+
|
|
69
|
+// 1.待审核 2.审核未通过 3.未发送 4.已发送 5.发送失败
|
|
70
|
+const (
|
|
71
|
+ SMSBatchStatusInReview = int8(1)
|
|
72
|
+ SMSBatchStatusUnapproved = int8(2)
|
|
73
|
+ SMSBatchStatusUnsend = int8(3)
|
|
74
|
+ SMSBatchStatusDidSend = int8(4)
|
|
75
|
+ SMSBatchStatusSendFailed = int8(5)
|
|
76
|
+ SMSBatchStatusSending = int8(6)
|
|
77
|
+)
|