uniugm/admin/apps/game/model/item_bag.go
2025-05-14 18:09:20 +08:00

41 lines
1.1 KiB
Go

package model
import (
"admin/apps/game/model/dto"
"admin/internal/db"
"time"
)
func init() {
db.RegisterTableModels(ItemBag{})
}
// 道具包,配置一系列道具,供邮件、礼包码填写使用
type ItemBag struct {
ID int `gorm:"primarykey" readonly:"true"`
ProjectId int `gorm:"uniqueIndex:idx_whitelist"`
Name string `gorm:"type:varchar(255);uniqu" name:"礼包名称" desc:"请输入礼包名称,全项目唯一" required:"true" where:"eq"`
Attach []*MailAttachItem `gorm:"type:json;serializer:json" name:"邮件附件" type:"items" desc:"搜索道具并点击添加"`
CreatedAt time.Time `readonly:"true" where:"range"`
}
func (lm *ItemBag) TableName() string {
return "item_bag"
}
func (m *ItemBag) GetId() int {
return m.ID
}
func (m *ItemBag) GetChoiceServers(project *Project) []*dto.CommonDtoFieldChoice {
return getChoiceServers(project)
}
func (m *ItemBag) GetWhitelistTypeChoices(project *Project) []*dto.CommonDtoFieldChoice {
return []*dto.CommonDtoFieldChoice{
{Desc: "IP", Value: "ip"},
{Desc: "账号", Value: "account"},
}
}