42 lines
1.3 KiB
Go
42 lines
1.3 KiB
Go
|
package model
|
||
|
|
||
|
import (
|
||
|
"admin/apps/game/model/dto"
|
||
|
"admin/internal/db"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
func init() {
|
||
|
db.RegisterTableModels(CDKey{})
|
||
|
}
|
||
|
|
||
|
type CDKey struct {
|
||
|
ID int `gorm:"primarykey" readonly:"true"`
|
||
|
ProjectId int `gorm:"index:idx_project_id"`
|
||
|
Desc string `name:"礼包说明" required:"true"`
|
||
|
ServerIDs []string `gorm:"type:json;serializer:json" name:"区服" type:"[]string" choices:"GetChoiceServers" multi_choice:"true"`
|
||
|
CodeType int `name:"礼包类型" required:"true" choices:"GetCodeTypeChoices"`
|
||
|
Code string `name:"礼包码" desc:"一码通用才配置"`
|
||
|
CodeNum int `name:"礼包数量" desc:"一码一用才配置"`
|
||
|
ValidStartTime time.Time `name:"生效起始时间"`
|
||
|
ValidEndTime time.Time `name:"生效结束时间"`
|
||
|
RewardList []*MailAttachItem `gorm:"type:json;serializer:json" name:"邮件附件" type:"items" desc:"搜索道具并点击添加"`
|
||
|
|
||
|
CreatedAt time.Time `readonly:"true"`
|
||
|
}
|
||
|
|
||
|
func (lm *CDKey) TableName() string {
|
||
|
return "cdkey"
|
||
|
}
|
||
|
|
||
|
func (m *CDKey) GetId() int {
|
||
|
return m.ID
|
||
|
}
|
||
|
|
||
|
func (m *CDKey) GetCodeTypeChoices() []*dto.CommonDtoFieldChoice {
|
||
|
return []*dto.CommonDtoFieldChoice{
|
||
|
{Desc: "一码通用", Value: 0},
|
||
|
{Desc: "一码一用", Value: 1},
|
||
|
}
|
||
|
}
|