feat(cache): 添加复合键缓存操作支持

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

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

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

移除了基于单一字符串键的会话管理方法,因为已迁移到使用
复合键的缓存操作方式
```
This commit is contained in:
昔念
2026-01-19 18:51:56 +08:00
parent 08ebf849eb
commit 026689f3ed
120 changed files with 1428 additions and 629 deletions

View File

@@ -0,0 +1,22 @@
package admin
import (
"blazing/cool"
"blazing/modules/player/service"
)
type ItemBagController struct {
*cool.Controller
}
func init() {
var task_info_controller = &ItemBagController{
&cool.Controller{
Prefix: "/admin/sun/item",
Api: []string{"Delete", "Update", "Info", "List", "Page"},
Service: service.NewItemService(0), //因为page已经过滤所以这里需要改成0
},
}
// 注册路由
cool.RegisterController(task_info_controller)
}

View File

@@ -0,0 +1,50 @@
package admin
import (
"blazing/cool"
"blazing/modules/player/model"
"blazing/modules/player/service"
"context"
"github.com/gogf/gf/v2/frame/g"
)
type PetBagController struct {
*cool.Controller
}
type PetGetReq struct {
g.Meta `path:"/genpet" method:"POST"`
// 新增:精灵相关参数(完全对齐自定义表单配置)
PetTypeId int `json:"petTypeId" v:"required|min:1" comment:"精灵类型ID必填正整数最小1无0或负数类型对应GenPetInfo的id参数"`
IndividualValue int `json:"individualValue" v:"required|between:-1,31" comment:"精灵个体值,必填,范围-1~31-1表示随机生成满个体0~31为固定值决定基础属性上限"`
NatureId int `json:"natureId" v:"required|between:-1,24" comment:"精灵性格ID必填范围-1~24-1表示随机0~24对应25种固定性格影响属性加成"`
AbilityTypeEnum int `json:"abilityTypeEnum" v:"required|min:-1" comment:"精灵特性类型ID必填最小值-1-1表示随机选择1个特性0及以上为固定特性ID需与PlayerEffectMAP匹配"`
IsShiny int `json:"isShiny" v:"min:-1" comment:"精灵异色闪光ID必填最小值-1-1表示随机0及以上为固定异色状态稀有精灵特殊外观/属性原表单hidden但需保留必填逻辑"`
Level int `json:"level" v:"required|between:1,100" comment:"精灵等级必填范围1~100常规游戏等级上限影响精灵当前属性强度"`
}
func init() {
var task_info_controller = &PetBagController{
&cool.Controller{
Prefix: "/admin/monster/bag",
Api: []string{"Delete", "Update", "Info", "List", "Page"},
Service: service.NewPetService(0), //因为page已经过滤所以这里需要改成0
},
}
// 注册路由
cool.RegisterController(task_info_controller)
}
func (c *PetBagController) GetSession(ctx context.Context, req *PetGetReq) (res *cool.BaseRes, err error) {
var (
admin = cool.GetAdmin(ctx)
//r = g.RequestFromCtx(ctx)
)
t := model.GenPetInfo(
req.PetTypeId, req.IndividualValue, req.NatureId, req.AbilityTypeEnum, req.Level, nil)
t.FixShiny()
service.NewUserService(uint32(admin.UserId)).Pet.PetAdd(t)
return
}

View File

@@ -0,0 +1,38 @@
package admin
import (
"blazing/cool"
"blazing/modules/player/service"
"context"
"github.com/gogf/gf/v2/frame/g"
)
type PlayerController struct {
*cool.Controller
}
func init() {
var task_info_controller = &PlayerController{
&cool.Controller{
Prefix: "/admin/sun/player",
Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"},
Service: service.NewInfoService(0),
},
}
// 注册路由
cool.RegisterController(task_info_controller)
}
type KickReq struct {
g.Meta `path:"/kick" method:"POST"`
ID uint32 `json:"id"`
}
func (c *PlayerController) Kick(ctx context.Context, req *KickReq) (res *cool.BaseRes, err error) {
res = &cool.BaseRes{}
service.NewUserService(0).Info.Kick(uint32(req.ID))
return
}

View File

@@ -0,0 +1,50 @@
/*
* @Author: 昔念 12574910+72wo@users.noreply.github.com
* @Date: 2026-01-18 11:55:13
* @LastEditors: 昔念 12574910+72wo@users.noreply.github.com
* @LastEditTime: 2026-01-18 11:59:32
* @FilePath: \sun\modules\blazing\controller\admin\title.go
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
package admin
import (
"blazing/cool"
"blazing/modules/player/service"
"context"
"github.com/gogf/gf/v2/frame/g"
)
type TitleController struct {
*cool.Controller
}
func init() {
var task_info_controller = &TitleController{
&cool.Controller{
Prefix: "/admin/game/title",
Api: []string{"Delete", "Update", "Info", "List", "Page"},
Service: service.NewItemService(0), //因为page已经过滤所以这里需要改成0
},
}
// 注册路由
cool.RegisterController(task_info_controller)
}
type GetReq struct {
g.Meta `path:"/get" method:"POST"`
ID uint32 `json:"id"`
}
func (c *TitleController) Get(ctx context.Context, req *GetReq) (res *cool.BaseRes, err error) {
res = &cool.BaseRes{}
var (
admin = cool.GetAdmin(ctx)
//r = g.RequestFromCtx(ctx)
)
res.Data = service.NewUserService(uint32(admin.UserId)).Title.Get()
return
}