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 {
|
|
|
|
|
ID int32 `json:"id"`
|
|
|
|
|
Num int64 `json:"num"`
|
|
|
|
|
ItemType int `json:"item_type"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type RoleMail struct {
|
|
|
|
|
ID int `gorm:"primarykey" readonly:"true"`
|
|
|
|
|
ProjectId string
|
2025-04-28 15:56:04 +08:00
|
|
|
|
RoleIDs []string `gorm:"type:json;serializer:json" name:"生效的角色id" desc:"生效的角色id,逗号分隔多个" required:"true"`
|
|
|
|
|
ServerID string `name:"所属区服" choices:"GetChoiceServers" required:"true"`
|
2025-04-24 20:39:31 +08:00
|
|
|
|
Title string `name:"邮件标题" required:"true"`
|
|
|
|
|
Content string `name:"邮件内容" required:"true"`
|
|
|
|
|
Attach []*MailAttachItem `gorm:"type:json;serializer:json" name:"邮件附件" type:"items" choices:"GetChoiceItems"`
|
|
|
|
|
|
2025-04-28 15:56:04 +08:00
|
|
|
|
CreatedAt time.Time `readonly:"true"`
|
2025-04-24 20:39:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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]
|
|
|
|
|
}
|