44 lines
1.2 KiB
Go
44 lines
1.2 KiB
Go
|
package model
|
||
|
|
||
|
import (
|
||
|
"admin/apps/game/model/dto"
|
||
|
"admin/internal/db"
|
||
|
"gorm.io/gorm"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
func init() {
|
||
|
db.RegisterTableModels(GlobalMail{})
|
||
|
}
|
||
|
|
||
|
var ProjectsAllItems = make(map[string][]*dto.CommonDtoFieldChoice)
|
||
|
|
||
|
type GlobalMail struct {
|
||
|
ID int `gorm:"primarykey" readonly:"true"`
|
||
|
ProjectId string
|
||
|
ServerIDs []string `gorm:"type:json;serializer:json" name:"区服" type:"[]string" choices:"GetChoiceServers" multi_choice:"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"`
|
||
|
UpdatedAt time.Time `readonly:"true"`
|
||
|
DeletedAt gorm.DeletedAt `gorm:"index" readonly:"true"`
|
||
|
}
|
||
|
|
||
|
func (lm *GlobalMail) TableName() string {
|
||
|
return "mail_global"
|
||
|
}
|
||
|
|
||
|
func (m *GlobalMail) GetId() int {
|
||
|
return m.ID
|
||
|
}
|
||
|
|
||
|
func (m *GlobalMail) GetChoiceServers(projectId string) []*dto.CommonDtoFieldChoice {
|
||
|
return getChoiceServers(projectId)
|
||
|
}
|
||
|
|
||
|
func (m *GlobalMail) GetChoiceItems(projectId string) []*dto.CommonDtoFieldChoice {
|
||
|
return ProjectsAllItems[projectId]
|
||
|
}
|