package models type SMSTemplate struct { ID int64 `gorm:"column:id"` TemplateType int8 `gorm:"column:template_type"` // 模板类型 1.默认模板 2.自定义模板 TemplateID int64 `gorm:"column:template_id"` // 短信平台上的模板 id MessageType int8 `gorm:"column:message_type"` // 短信类型 1.通知短信 2.服务短信 Content string // 模板内容 // ParamTypes string `gorm:"column:param_types"` // 字段因业务没有采用默认模板的方式而弃用了!!!! 模板内容里的参数类型:1,2,3 。参数类型以逗号隔开,位置代表了参数‘{n+1}’,类型暂时有:1.用户名 2.商家简称 3.链接 4.商品名称 5.活动名称 6.验证码。(自定义模板是没有值的,因为它没有参数) Autograph string // 短信签名 OrgID int64 `gorm:"column:org_id"` // 模板所属机构(自定义模板才有值) Status int8 // 模板状态 0.无效 1.有效 2.审核中 CreateTime int64 `gorm:"column:ctime"` // 创建时间 ModifyTime int64 `gorm:"column:mtime"` // 修改时间 } func (SMSTemplate) TableName() string { return "sgj_patient_sms_template" } type UserSMSFreeLimit struct { ID int64 `gorm:"column:id"` OrgID int64 `gorm:"column:org_id"` // 机构 ID TotalCount int `gorm:"column:total_count"` // 免费额度,单位:条,下同 UsedCount int `gorm:"column:used_count"` // 已用额度 ValidMonth string `gorm:"column:valid_month"` // 生效月份,格式:201804 Status int8 // 状态 0.无效 1.有效 CreateTime int64 `gorm:"column:ctime"` // 创建时间 ModifyTime int64 `gorm:"column:mtime"` // 修改时间 } func (UserSMSFreeLimit) TableName() string { return "sgj_patient_user_sms_free_limit" } type SMSBatch struct { ID int64 `gorm:"column:id"` OrgID int64 `gorm:"column:org_id"` // 机构 ID TemplateID int64 `gorm:"column:sms_template_id"` // 对应短信平台上的模板 ID Autograph string // 短信签名 Params string // 模板参数,以“,”隔开 FullContent string `gorm:"column:full_content"` // 完整短信内容 Mobiles string // 接收手机号,以“,”隔开 SendTime int64 `gorm:"column:send_time"` // 发送时间 Status int8 // 状态: 1.待审核 2.审核未通过 3.未发送 4.已发送 5.发送失败 CreateTime int64 `gorm:"column:ctime"` // 创建时间 ModifyTime int64 `gorm:"column:mtime"` // 修改时间 } func (SMSBatch) TableName() string { return "sgj_patient_sms_batch" } type SMSSendStatus struct { ID int64 `gorm:"column:id"` BatchID int64 `gorm:"batch_id"` // 批次 ID,对应 SMSBatch.ID Mobile string // 接收手机号 Status int8 // 发送结果状态: 0.失败 1.成功 Code string // 短信平台返回的错误码 Msg string // 短信平台返回的错误信息 CreateTime int64 `gorm:"column:ctime"` // 创建时间 ModifyTime int64 `gorm:"column:mtime"` // 修改时间 } func (SMSSendStatus) TableName() string { return "sgj_patient_sms_send_status" } // 1.待审核 2.审核未通过 3.未发送 4.已发送 5.发送失败 const ( SMSBatchStatusInReview = int8(1) SMSBatchStatusUnapproved = int8(2) SMSBatchStatusUnsend = int8(3) SMSBatchStatusDidSend = int8(4) SMSBatchStatusSendFailed = int8(5) SMSBatchStatusSending = int8(6) )