You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
90 lines
2.8 KiB
90 lines
2.8 KiB
|
1 year ago
|
package common
|
||
|
|
|
||
|
|
import "server/pb"
|
||
|
|
|
||
|
|
// type Mail struct {
|
||
|
|
// ID int `gorm:"primary_key;AUTO_INCREMENT;column:id" json:"id" redis:"id"`
|
||
|
|
// Sender int `gorm:"column:sender;type:int(11);default:0;comment:发件人uid,系统为0" json:"sender" redis:"sender"`
|
||
|
|
// Receiver int `gorm:"column:receiver;type:int(11);default:0;comment:收件人uid,系统为0" json:"receiver" redis:"receiver"`
|
||
|
|
// }
|
||
|
|
|
||
|
|
const (
|
||
|
|
MailExpireTime = 30 * 24 * 60 * 60 // 30天
|
||
|
|
MailMaxCount = 100
|
||
|
|
)
|
||
|
|
|
||
|
|
const (
|
||
|
|
MailTypeNormal = iota + 1
|
||
|
|
MailTypeUrgent
|
||
|
|
)
|
||
|
|
|
||
|
|
const (
|
||
|
|
MailSendMethodImmediately = iota + 1
|
||
|
|
MailSendMethodTiming
|
||
|
|
)
|
||
|
|
|
||
|
|
const (
|
||
|
|
MailStatusDelete = iota
|
||
|
|
MailStatusNew
|
||
|
|
MailStatusRead
|
||
|
|
MailStatusDraw
|
||
|
|
)
|
||
|
|
|
||
|
|
// Mail 邮件
|
||
|
|
// DraftID 发送邮件的模板id
|
||
|
|
// sender 发件人
|
||
|
|
// Receiver 收件人uid 0是系统邮件
|
||
|
|
// Type 邮件类型 1跳转游戏
|
||
|
|
// Status 邮件状态 0删除 1未读 2已读未领取 3已领取
|
||
|
|
// Time 收到邮件的时间
|
||
|
|
type Mail struct {
|
||
|
|
ID int `gorm:"primary_key;AUTO_INCREMENT;column:id" json:"ID"`
|
||
|
|
DraftID string `gorm:"column:draft_id;type:varchar(256);comment:发送邮件的模板id" json:"DraftID"`
|
||
|
|
Sender string `gorm:"column:sender;type:varchar(64);default:0;comment:发件人名称" json:"Sender"`
|
||
|
|
Receiver int `gorm:"column:receiver;type:int(11);default:0;comment:收件人uid,系统为0" json:"Receiver"`
|
||
|
|
Tag int `gorm:"column:tag;type:int(11);default:1;comment:页签 1平台 2个人" json:"Tag"`
|
||
|
|
Type int `gorm:"column:type;type:int(11);default:0;comment:邮件类型 1正常 2紧急" json:"Type"`
|
||
|
|
Data string `gorm:"column:data;type:varchar(512);default:'';comment:数据" json:"Data"`
|
||
|
|
Title string `gorm:"column:title;type:varchar(256);default:0;comment:标题" json:"Title"`
|
||
|
|
Content string `gorm:"column:content;type:varchar(512);default:0;comment:正文" json:"Content"`
|
||
|
|
Status int `gorm:"column:status;type:tinyint(4);default:1;comment:邮件状态 0删除 1未读 2已读未领取 3已领取" json:"Status"`
|
||
|
|
Time int64 `gorm:"column:time;type:bigint(20);default:0;comment:收到邮件时间" json:"Time"`
|
||
|
|
}
|
||
|
|
|
||
|
|
func (u *Mail) TableName() string {
|
||
|
|
return "mail"
|
||
|
|
}
|
||
|
|
|
||
|
|
const (
|
||
|
|
MailDraftStatusDelete = iota
|
||
|
|
MailDraftStatusNew
|
||
|
|
MailDraftStatusSent
|
||
|
|
MailDraftStatusBack // 撤销
|
||
|
|
)
|
||
|
|
|
||
|
|
// MailDraft 邮件草稿
|
||
|
|
// ID 草稿ID
|
||
|
|
// sender 发件人
|
||
|
|
// Receiver 收件人uid(可以是数组),空数组代表所有人
|
||
|
|
// Type 邮件类型 1正常 2紧急
|
||
|
|
// Enclosure 附件
|
||
|
|
// SendMethod 发送方式 1立刻 2定时
|
||
|
|
// SendTime 发送时间
|
||
|
|
// Status 邮件状态 0删除 1未发送 2已发送 3已撤销
|
||
|
|
// Operator 操作人
|
||
|
|
// Time 创建或修改的时间戳
|
||
|
|
type MailDraft struct {
|
||
|
|
ID string
|
||
|
|
Sender string
|
||
|
|
Receiver []int
|
||
|
|
Type int
|
||
|
|
Title string
|
||
|
|
Content string
|
||
|
|
Enclosure []*pb.CurrencyPair
|
||
|
|
SendMethod int
|
||
|
|
SendTime int64
|
||
|
|
Status int
|
||
|
|
Operator string
|
||
|
|
Time int64
|
||
|
|
}
|