47 lines
2.0 KiB
Go
47 lines
2.0 KiB
Go
package model
|
||
|
||
import (
|
||
"blazing/cool"
|
||
)
|
||
|
||
// 表名常量定义:物品奖励表(存储物品奖励的核心配置信息)
|
||
const (
|
||
TableNameItemGift = "config_gift_item" // 物品奖励配置表(包含物品关联、数量、启用状态、扭蛋标识及备注信息)
|
||
)
|
||
|
||
// ItemGift 物品奖励基础配置模型(与数据库表 item_gift 字段一一对应,核心存储结构)
|
||
type ItemGift struct {
|
||
*cool.Model // 保留通用Model(ID/创建时间/更新时间等)
|
||
// 核心业务字段(按需求实现:物品id、备注、是否启用、是否为扭蛋、物品数量)
|
||
ItemID int64 `gorm:"not null;default:0;comment:'物品ID,关联物品配置表主键'" json:"item_id"`
|
||
|
||
IsEgg uint32 `gorm:"not null;default:0;comment:'是否蛋'" json:"is_egg"` //奖励是否为扭蛋奖励
|
||
//ItemCount uint32 `gorm:"not null;default:1;comment:'物品奖励数量'" json:"item_count"`
|
||
ItemMinCount int64 `gorm:"column:item_min_count;not null;comment:单次采集最小产出数量" json:"item_min_count"`
|
||
// ItemMaxCount 单次采集最大产出数量
|
||
ItemMaxCount uint32 `gorm:"column:item_max_count;not null;comment:单次采集最大产出数量" json:"item_max_count"`
|
||
Remark string `gorm:"type:varchar(255);default:'';comment:'性别配置备注(如:默认性别规则)'" json:"remark"` // 调整注释
|
||
}
|
||
|
||
// TableName 指定ItemGift对应的数据库表名(遵循现有代码规范)
|
||
func (*ItemGift) TableName() string {
|
||
return TableNameItemGift
|
||
}
|
||
|
||
// GroupName 指定表所属的分组(与现有BossConfig、PetReward保持一致,统一为default分组)
|
||
func (*ItemGift) GroupName() string {
|
||
return "default"
|
||
}
|
||
|
||
// NewItemGift 创建一个新的ItemGift实例(初始化通用Model字段+默认值,与现有实例创建逻辑一致)
|
||
func NewItemGift() *ItemGift {
|
||
return &ItemGift{
|
||
Model: cool.NewModel(),
|
||
}
|
||
}
|
||
|
||
// init 程序启动时自动创建/同步item_gift表结构(与现有表同步逻辑保持一致)
|
||
func init() {
|
||
cool.CreateTable(&ItemGift{})
|
||
}
|