feat(cache): 添加复合键缓存操作支持 添加了基于 uint32+string 组合键的缓存操作方法,包括 GetByCompoundKey、SetByCompoundKey、DelByCompoundKey 和 ContainsByCompoundKey 方法,用于处理用户ID和会话ID的组合缓存场景 fix(vscode): 添加 cSpell 配置支持 struc 词汇 refactor(session): 移除过时的会话管理方法 移除了基于单一字符串键的会话管理方法,因为已迁移到使用 复合键的缓存操作方式 ```
38 lines
772 B
Go
38 lines
772 B
Go
package model
|
||
|
||
import (
|
||
"blazing/cool"
|
||
)
|
||
|
||
// 表名常量
|
||
const TableNamePlayerCdkLog = "player_cdk_log"
|
||
|
||
// CdkLog 对应数据库表 player_cdk_log,用于记录CDK兑换日志
|
||
type CdkLog struct {
|
||
Base
|
||
PlayerID uint64 `gorm:"not null;index:idx_player_cdk_log_by_player_id;comment:'所属玩家ID'" json:"player_id"`
|
||
CodeID uint32 `gorm:"not null;comment:'CDK编号'" json:"code_id"`
|
||
}
|
||
|
||
// TableName 返回表名
|
||
func (*CdkLog) TableName() string {
|
||
return TableNamePlayerCdkLog
|
||
}
|
||
|
||
// GroupName 返回表组名
|
||
func (*CdkLog) GroupName() string {
|
||
return "default"
|
||
}
|
||
|
||
// NewCdkLog 创建一个新的CDK记录
|
||
func NewCdkLog() *CdkLog {
|
||
return &CdkLog{
|
||
Base: *NewBase(),
|
||
}
|
||
}
|
||
|
||
// init 程序启动时自动创建表
|
||
func init() {
|
||
cool.CreateTable(&CdkLog{})
|
||
}
|