2025-12-21 18:13:54 +00:00
|
|
|
|
package model
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
"blazing/cool"
|
|
|
|
|
|
"time"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// 表名常量定义:CDK配置表
|
|
|
|
|
|
const (
|
2026-01-19 18:51:56 +08:00
|
|
|
|
TableNameCDKConfig = "config_gift_cdk" // CDK配置表(记录CDK编号、可兑换次数、奖励配置等核心信息)
|
2025-12-21 18:13:54 +00:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// CDKConfig CDK核心配置模型(含可兑换次数,满足查询`where 可兑换次数 != 0`需求)
|
|
|
|
|
|
type CDKConfig struct {
|
2026-01-19 18:51:56 +08:00
|
|
|
|
*cool.Model
|
2025-12-21 18:13:54 +00:00
|
|
|
|
|
|
|
|
|
|
// 核心字段
|
2026-01-19 18:51:56 +08:00
|
|
|
|
CDKCode string `gorm:"not null;size:16;uniqueIndex;comment:'CDK编号(唯一标识,用于玩家兑换)'" json:"cdk_code" description:"CDK编号"`
|
2026-04-08 15:49:03 +08:00
|
|
|
|
CDKType uint32 `gorm:"column:type;not null;default:0;comment:'CDK类型:0普通奖励,1服务器冠名'" json:"type" description:"CDK类型"`
|
2025-12-21 18:13:54 +00:00
|
|
|
|
|
|
|
|
|
|
//cdk可兑换次数,where不等于0
|
2026-01-19 18:51:56 +08:00
|
|
|
|
ExchangeRemainCount int64 `gorm:"not null;default:1;comment:'CDK剩余可兑换次数(不能为0才允许兑换,支持查询where !=0)'" json:"exchange_remain_count" description:"剩余可兑换次数"`
|
2026-01-20 22:08:36 +00:00
|
|
|
|
ItemRewardIds []uint32 `gorm:"not null;type:jsonb;default:'[]';comment:'绑定奖励物品ID数组,关联item_gift表主键'" json:"item_reward_ids" description:"奖励物品数组"`
|
|
|
|
|
|
ElfRewardIds []uint32 `gorm:"not null;type:jsonb;default:'[]';comment:'绑定奖励精灵ID数组,关联config_pet_boss表主键'" json:"elf_reward_ids" description:"奖励精灵数组"`
|
2026-01-19 18:51:56 +08:00
|
|
|
|
TitleRewardIds uint32 `gorm:"not null;default:0;comment:'绑定奖励称号'" json:"title_reward_ids" description:"绑定奖励称号"`
|
2026-02-13 03:04:04 +08:00
|
|
|
|
//绑定用户
|
|
|
|
|
|
BindUserId uint32 `gorm:"not null;default:0;comment:'绑定用户ID'" json:"bind_user_id" description:"绑定用户ID"`
|
2025-12-21 18:13:54 +00:00
|
|
|
|
|
2026-01-19 18:51:56 +08:00
|
|
|
|
ValidEndTime time.Time `gorm:"not null;comment:'CDK有效结束时间'" json:"valid_end_time" description:"有效结束时间"`
|
|
|
|
|
|
|
|
|
|
|
|
Remark string `gorm:"size:512;default:'';comment:'CDK备注'" json:"remark" description:"备注信息"`
|
2025-12-21 18:13:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------- 核心配套方法(遵循项目规范)--------------------------
|
|
|
|
|
|
func (*CDKConfig) TableName() string {
|
|
|
|
|
|
return TableNameCDKConfig
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (*CDKConfig) GroupName() string {
|
|
|
|
|
|
return "default"
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func NewCDKConfig() *CDKConfig {
|
|
|
|
|
|
return &CDKConfig{
|
2026-01-19 18:51:56 +08:00
|
|
|
|
Model: cool.NewModel(),
|
2025-12-21 18:13:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------- 表结构自动同步 --------------------------
|
|
|
|
|
|
func init() {
|
|
|
|
|
|
cool.CreateTable(&CDKConfig{})
|
|
|
|
|
|
}
|