2025-04-24 20:39:31 +08:00
|
|
|
package model
|
|
|
|
|
|
|
|
import (
|
|
|
|
"admin/internal/db"
|
2025-05-16 15:17:10 +08:00
|
|
|
"admin/internal/model/dto"
|
2025-05-15 17:30:33 +08:00
|
|
|
"database/sql"
|
2025-04-24 20:39:31 +08:00
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
db.RegisterTableModels(GlobalMail{})
|
|
|
|
}
|
|
|
|
|
|
|
|
type GlobalMail struct {
|
2025-05-15 17:30:33 +08:00
|
|
|
ID int `gorm:"primarykey" readonly:"true"`
|
|
|
|
ProjectId int `gorm:"index:idx_project_id"`
|
|
|
|
ServerIDs []string `gorm:"type:json;serializer:json" desc:"不选就是默认所有区服" name:"区服" type:"[]string" choices:"GetChoiceServers" multi_choice:"true"`
|
|
|
|
Title string `name:"邮件标题" required:"true"`
|
|
|
|
Content string `name:"邮件内容" required:"true"`
|
|
|
|
DelayInvokeCreateHook sql.NullTime `name:"邮件定时发送时间" desc:"不填或者无效就立即发送"`
|
|
|
|
ExpireAt sql.NullTime `name:"邮件到期时间" desc:"不填就是永久有效"`
|
|
|
|
CreateRoleTimeBefore sql.NullTime `name:"创角时间" desc:"在这时间之前创建的角色才能收到邮件,不填就是都生效"`
|
|
|
|
TotalPayMoney int `name:"充值金额大于" desc:"充值金额大于的才能收到邮件,不填就是没有要求"`
|
|
|
|
RoleLevel int `name:"角色等级大于" desc:"角色等级大于的才能收到邮件,不填就是没有要求"`
|
|
|
|
Attach []*MailAttachItem `gorm:"type:json;serializer:json" name:"邮件附件" type:"items" desc:"搜索道具并点击添加"`
|
2025-04-24 20:39:31 +08:00
|
|
|
|
2025-05-05 10:30:33 +08:00
|
|
|
CreatedAt time.Time `readonly:"true" where:"range"`
|
2025-05-15 17:30:33 +08:00
|
|
|
UpdatedAt time.Time `readonly:"true"`
|
2025-04-24 20:39:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (lm *GlobalMail) TableName() string {
|
|
|
|
return "mail_global"
|
|
|
|
}
|
|
|
|
|
2025-05-19 17:51:09 +08:00
|
|
|
func (m *GlobalMail) GetShowKey() string {
|
|
|
|
return m.Title
|
|
|
|
}
|
|
|
|
|
2025-04-24 20:39:31 +08:00
|
|
|
func (m *GlobalMail) GetId() int {
|
|
|
|
return m.ID
|
|
|
|
}
|
|
|
|
|
2025-04-30 15:46:14 +08:00
|
|
|
func (m *GlobalMail) GetChoiceServers(project *Project) []*dto.CommonDtoFieldChoice {
|
|
|
|
return getChoiceServers(project)
|
2025-04-24 20:39:31 +08:00
|
|
|
}
|