uniugm/admin/apps/game/model/rolemail.go
2025-04-28 15:56:04 +08:00

46 lines
1.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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]
}