feat(cache): 添加复合键缓存操作支持 添加了基于 uint32+string 组合键的缓存操作方法,包括 GetByCompoundKey、SetByCompoundKey、DelByCompoundKey 和 ContainsByCompoundKey 方法,用于处理用户ID和会话ID的组合缓存场景 fix(vscode): 添加 cSpell 配置支持 struc 词汇 refactor(session): 移除过时的会话管理方法 移除了基于单一字符串键的会话管理方法,因为已迁移到使用 复合键的缓存操作方式 ```
52 lines
1015 B
Go
52 lines
1015 B
Go
package model
|
||
|
||
import (
|
||
"blazing/cool"
|
||
)
|
||
|
||
const TableNamePlayerBagItem = "player_item"
|
||
|
||
// PlayerBagItem mapped from table <player_bag_item>
|
||
type Item struct {
|
||
Base
|
||
PlayerID uint64 `gorm:"not null;index:idx_player_bag_item_by_player_id;comment:'所属玩家ID'" json:"player_id"`
|
||
// 物品Id,
|
||
ItemId uint32 `json:"item_id"`
|
||
|
||
// 物品数量,
|
||
ItemCnt uint32 `json:"item_cnt"`
|
||
}
|
||
|
||
type SingleItemInfo struct {
|
||
// 物品Id,
|
||
ItemId uint32 `json:"itemId"`
|
||
// 物品数量,
|
||
ItemCnt uint32 `json:"itemCnt"`
|
||
// 固定值360000,
|
||
LeftTime uint32 `json:"leftTime"`
|
||
// 固定值0,
|
||
ItemLevel uint32 `json:"itemLevel"`
|
||
}
|
||
|
||
// TableName PlayerBagItem's table name
|
||
func (*Item) TableName() string {
|
||
return TableNamePlayerBagItem
|
||
}
|
||
|
||
// GroupName PlayerBagItem's table group
|
||
func (*Item) GroupName() string {
|
||
return "default"
|
||
}
|
||
|
||
// NewPlayerBagItem create a new PlayerBagItem
|
||
func NewPlayerBag() *Item {
|
||
return &Item{
|
||
Base: *NewBase(),
|
||
}
|
||
}
|
||
|
||
// init 创建表
|
||
func init() {
|
||
cool.CreateTable(&Item{})
|
||
}
|