Files
bl/modules/config/model/item_gift.go
昔念 026689f3ed ```
feat(cache): 添加复合键缓存操作支持

添加了基于 uint32+string 组合键的缓存操作方法,包括
GetByCompoundKey、SetByCompoundKey、DelByCompoundKey 和
ContainsByCompoundKey 方法,用于处理用户ID和会话ID的组合缓存场景

fix(vscode): 添加 cSpell 配置支持 struc 词汇

refactor(session): 移除过时的会话管理方法

移除了基于单一字符串键的会话管理方法,因为已迁移到使用
复合键的缓存操作方式
```
2026-01-19 18:51:56 +08:00

50 lines
2.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package model
import (
"blazing/cool"
)
// 表名常量定义:物品奖励表(存储物品奖励的核心配置信息)
const (
TableNameItemGift = "config_gift_item" // 物品奖励配置表(包含物品关联、数量、启用状态、扭蛋标识及备注信息)
)
// ItemGift 物品奖励基础配置模型(与数据库表 item_gift 字段一一对应,核心存储结构)
type ItemGift struct {
*cool.Model // 嵌入通用Model包含ID/创建时间/更新时间等通用字段,保持与现有模型一致性)
// 核心业务字段按需求实现物品id、备注、是否启用、是否为扭蛋、物品数量
ItemID uint32 `gorm:"not null;default:0;comment:'物品ID关联物品配置表主键'" json:"item_id"`
Remark string `gorm:"size:512;default:'';comment:'物品奖励备注说明(如使用场景、特殊说明等)'" json:"remark"`
IsEnabled uint32 `gorm:"not null;default:1;comment:'是否启用0-禁用 1-启用)'" json:"is_enabled"`
IsEgg uint32 `gorm:"not null;default:0;comment:'是否蛋'" json:"is_egg"` //奖励是否为扭蛋奖励
//ItemCount uint32 `gorm:"not null;default:1;comment:'物品奖励数量'" json:"item_count"`
ItemMinCount uint32 `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"`
}
// 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(), // 初始化通用Model字段ID/创建时间/更新时间等)
// 字段默认值与gorm tag中default配置保持一致
IsEnabled: 1,
}
}
// init 程序启动时自动创建/同步item_gift表结构与现有表同步逻辑保持一致
func init() {
cool.CreateTable(&ItemGift{})
}