package model import ( "admin/internal/consts" "admin/internal/db" "admin/internal/model/dto" "time" ) func init() { db.RegisterTableModels(RoleMail{}) } type MailAttachItem struct { ID int32 `json:"id"` Num int64 `json:"num"` Desc string `json:"desc"` ItemType int `json:"item_type"` } type RoleMail struct { ID int `gorm:"primarykey" readonly:"true"` ProjectId int `gorm:"index:idx_project_id"` ServerID string `name:"所属区服" choices:"GetChoiceServers" required:"true" where:"eq"` RoleIDs []string `gorm:"type:json;serializer:json" name:"生效的角色id" desc:"生效的角色id,逗号分隔多个" required:"true" big_column:"true"` Title string `name:"邮件标题" required:"true" big_column:"true"` Content string `name:"邮件内容" required:"true" big_column:"true"` Attach []*MailAttachItem `gorm:"type:json;serializer:json" name:"邮件附件" type:"items" desc:"搜索道具并点击添加"` CreatedAt time.Time `readonly:"true" where:"range"` UpdatedAt time.Time `readonly:"true"` ReviewCheckStatus string `gorm:"type:varchar(20);default:pending" name:"审核状态" type:"tagStatus" choices:"GetStatusChoices" readonly:"true"` PostUserId int `name:"发送用户id" readonly:"true"` PostUserName string `name:"发送用户名字" readonly:"true"` ReviewNeedCharacters []string `gorm:"type:json;serializer:json" name:"审核角色组" readonly:"true"` ReviewUserId int `name:"审核员id" readonly:"true"` ReviewUserName string `name:"审核员名字" readonly:"true"` } func (lm *RoleMail) TableName() string { return "mail_role" } func (m *RoleMail) GetId() int { return m.ID } func (m *RoleMail) GetShowKey() string { return m.Title } func (m *RoleMail) GetChoiceServers(project *Project) []*dto.CommonDtoFieldChoice { return getChoiceServers(project) } func (m *RoleMail) GetStatusChoices(project *Project) []*dto.CommonDtoFieldChoice { return []*dto.CommonDtoFieldChoice{ {Desc: "审核通过已发放", Value: consts.OpReviewStatus_Ok, Type: 2}, // type: 0:plain 1:primary 2:success 3:info 4:warning 5:danger {Desc: "待审核", Value: consts.OpReviewStatus_Pending, Type: 3}, {Desc: "已发放", Value: consts.OpReviewStatus_DirectOk, Type: 2}, } }