uniugm/admin/apps/game/model/globalmail.go

46 lines
1.9 KiB
Go

package model
import (
"admin/internal/db"
"admin/internal/model/dto"
"database/sql"
"time"
)
func init() {
db.RegisterTableModels(GlobalMail{})
}
type GlobalMail struct {
ID int `gorm:"primarykey" readonly:"true"`
ProjectId int `gorm:"index:idx_project_id"`
ServerIDs []string `gorm:"type:json;serializer:json" desc:"不选就是默认所有区服" name:"区服" type:"[]string" choices:"GetChoiceServers" multi_choice:"true"`
Title string `name:"邮件标题" required:"true" big_column:"true"`
Content string `name:"邮件内容" required:"true" big_column:"true"`
DelayInvokeCreateHook sql.NullTime `name:"邮件定时发送时间" desc:"不填或者无效就立即发送"`
ExpireAt sql.NullTime `name:"邮件到期时间" desc:"不填就是永久有效"`
CreateRoleTimeBefore sql.NullTime `name:"创角时间" desc:"在这时间之前创建的角色才能收到邮件,不填就是都生效"`
TotalPayMoney int `name:"充值金额大于" desc:"充值金额大于的才能收到邮件,不填就是没有要求"`
RoleLevel int `name:"角色等级大于" desc:"角色等级大于的才能收到邮件,不填就是没有要求"`
Attach []*MailAttachItem `gorm:"type:json;serializer:json" name:"邮件附件" type:"items" desc:"搜索道具并点击添加"`
CreatedAt time.Time `readonly:"true" where:"range"`
UpdatedAt time.Time `readonly:"true"`
}
func (lm *GlobalMail) TableName() string {
return "mail_global"
}
func (m *GlobalMail) GetShowKey() string {
return m.Title
}
func (m *GlobalMail) GetId() int {
return m.ID
}
func (m *GlobalMail) GetChoiceServers(project *Project) []*dto.CommonDtoFieldChoice {
return getChoiceServers(project)
}