46 lines
1.2 KiB
Go
46 lines
1.2 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 string
|
||
RoleIDs []string `gorm:"type:json;serializer:json" name:"生效的角色id" desc:"生效的角色id,逗号分隔多个" required:"true"`
|
||
ServerID string `name:"所属区服" choices:"GetChoiceServers" required:"true"`
|
||
Title string `name:"邮件标题" required:"true"`
|
||
Content string `name:"邮件内容" required:"true"`
|
||
Attach []*MailAttachItem `gorm:"type:json;serializer:json" name:"邮件附件" type:"items" choices:"GetChoiceItems"`
|
||
|
||
CreatedAt time.Time `readonly:"true"`
|
||
}
|
||
|
||
func (lm *RoleMail) TableName() string {
|
||
return "mail_role"
|
||
}
|
||
|
||
func (m *RoleMail) GetId() int {
|
||
return m.ID
|
||
}
|
||
|
||
func (m *RoleMail) GetChoiceServers(projectId string) []*dto.CommonDtoFieldChoice {
|
||
return getChoiceServers(projectId)
|
||
}
|
||
|
||
func (m *RoleMail) GetChoiceItems(projectId string) []*dto.CommonDtoFieldChoice {
|
||
return ProjectsAllItems[projectId]
|
||
}
|