42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
package model
|
||
|
||
import (
|
||
"admin/apps/game/model/dto"
|
||
"admin/internal/db"
|
||
"time"
|
||
)
|
||
|
||
func init() {
|
||
db.RegisterTableModels(RoleMail{})
|
||
}
|
||
|
||
type MailAttachItem struct {
|
||
ID int32 `json:"id"`
|
||
Num int64 `json:"num"`
|
||
ItemType int `json:"item_type"`
|
||
}
|
||
|
||
type RoleMail struct {
|
||
ID int `gorm:"primarykey" readonly:"true"`
|
||
ProjectId int
|
||
RoleIDs []string `gorm:"type:json;serializer:json" name:"生效的角色id" desc:"生效的角色id,逗号分隔多个" required:"true"`
|
||
ServerID string `name:"所属区服" choices:"GetChoiceServers" required:"true" where:"eq"`
|
||
Title string `name:"邮件标题" required:"true"`
|
||
Content string `name:"邮件内容" required:"true"`
|
||
Attach []*MailAttachItem `gorm:"type:json;serializer:json" name:"邮件附件" type:"items" desc:"搜索道具并点击添加"`
|
||
|
||
CreatedAt time.Time `readonly:"true" where:"range"`
|
||
}
|
||
|
||
func (lm *RoleMail) TableName() string {
|
||
return "mail_role"
|
||
}
|
||
|
||
func (m *RoleMail) GetId() int {
|
||
return m.ID
|
||
}
|
||
|
||
func (m *RoleMail) GetChoiceServers(project *Project) []*dto.CommonDtoFieldChoice {
|
||
return getChoiceServers(project)
|
||
}
|