feat(cache): 添加复合键缓存操作支持 添加了基于 uint32+string 组合键的缓存操作方法,包括 GetByCompoundKey、SetByCompoundKey、DelByCompoundKey 和 ContainsByCompoundKey 方法,用于处理用户ID和会话ID的组合缓存场景 fix(vscode): 添加 cSpell 配置支持 struc 词汇 refactor(session): 移除过时的会话管理方法 移除了基于单一字符串键的会话管理方法,因为已迁移到使用 复合键的缓存操作方式 ```
49 lines
1.7 KiB
Go
49 lines
1.7 KiB
Go
package model
|
||
|
||
import "blazing/cool"
|
||
|
||
const (
|
||
TableNamePetFusionMaterial = "config_fusion_material" // 宠物融合材料表(子表)
|
||
)
|
||
|
||
// PetFusionMaterial 融合材料模型(与配方主表一对一关联)
|
||
type PetFusionMaterial struct {
|
||
*cool.Model // 嵌入通用Model(ID/创建时间/更新时间等)
|
||
|
||
// 4个材料ID(对应XML ItemGroup的Idx=1-4,无材料填0)
|
||
Material1 uint32 `gorm:"not null;comment:'材料1ID(如400030)'" json:"material1"`
|
||
Material2 uint32 `gorm:"not null;comment:'材料2ID(如400030)'" json:"material2"`
|
||
Material3 uint32 `gorm:"not null;comment:'材料3ID(如400028)'" json:"material3"`
|
||
Material4 uint32 `gorm:"not null;comment:'材料4ID(如400030)'" json:"material4"`
|
||
|
||
// 4个特性ID(对应XML MaterialGroup的特性索引,4-4对应)
|
||
Trait1Idx uint32 `gorm:"not null;comment:'特性1索引(如1008)'" json:"trait1_idx"`
|
||
Trait2Idx uint32 `gorm:"not null;comment:'特性2索引(如1018)'" json:"trait2_idx"`
|
||
Trait3Idx uint32 `gorm:"not null;comment:'特性3索引(如1023)'" json:"trait3_idx"`
|
||
Trait4Idx uint32 `gorm:"not null;comment:'特性4索引(如1031)'" json:"trait4_idx"`
|
||
|
||
IsEnable int32 `gorm:"not null;default:1;comment:'是否启用该组合(1:启用,0:禁用)'" json:"is_enable"`
|
||
}
|
||
|
||
// TableName 指定子表名
|
||
func (*PetFusionMaterial) TableName() string {
|
||
return TableNamePetFusionMaterial
|
||
}
|
||
|
||
// GroupName 表分组(与主表一致)
|
||
func (*PetFusionMaterial) GroupName() string {
|
||
return "default"
|
||
}
|
||
|
||
// NewPetFusionMaterial 创建材料实例
|
||
func NewPetFusionMaterial() *PetFusionMaterial {
|
||
return &PetFusionMaterial{
|
||
Model: cool.NewModel(),
|
||
}
|
||
}
|
||
|
||
// init 初始化子表结构
|
||
func init() {
|
||
cool.CreateTable(&PetFusionMaterial{})
|
||
}
|