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

43 lines
1.2 KiB
Go
Raw Normal View History

2025-04-24 20:39:31 +08:00
package model
import (
"admin/apps/game/model/dto"
"admin/internal/db"
"time"
)
func init() {
db.RegisterTableModels(RoleMail{})
}
type MailAttachItem struct {
2025-05-07 18:25:31 +08:00
ID int32 `json:"id"`
Num int64 `json:"num"`
Desc string `json:"desc"`
ItemType int `json:"item_type"`
2025-04-24 20:39:31 +08:00
}
type RoleMail struct {
2025-05-07 15:03:19 +08:00
ID int `gorm:"primarykey" readonly:"true"`
ProjectId int `gorm:"index:idx_project_id"`
2025-05-04 22:07:13 +08:00
ServerID string `name:"所属区服" choices:"GetChoiceServers" required:"true" where:"eq"`
2025-05-14 18:09:20 +08:00
RoleIDs []string `gorm:"type:json;serializer:json" name:"生效的角色id" desc:"生效的角色id逗号分隔多个" required:"true"`
2025-04-24 20:39:31 +08:00
Title string `name:"邮件标题" required:"true"`
Content string `name:"邮件内容" required:"true"`
2025-05-04 22:07:13 +08:00
Attach []*MailAttachItem `gorm:"type:json;serializer:json" name:"邮件附件" type:"items" desc:"搜索道具并点击添加"`
2025-04-24 20:39:31 +08:00
2025-05-04 22:07:13 +08:00
CreatedAt time.Time `readonly:"true" where:"range"`
2025-04-24 20:39:31 +08:00
}
func (lm *RoleMail) TableName() string {
return "mail_role"
}
func (m *RoleMail) GetId() int {
return m.ID
}
2025-04-30 15:46:14 +08:00
func (m *RoleMail) GetChoiceServers(project *Project) []*dto.CommonDtoFieldChoice {
return getChoiceServers(project)
2025-04-24 20:39:31 +08:00
}