feat(cache): 添加复合键缓存操作支持 添加了基于 uint32+string 组合键的缓存操作方法,包括 GetByCompoundKey、SetByCompoundKey、DelByCompoundKey 和 ContainsByCompoundKey 方法,用于处理用户ID和会话ID的组合缓存场景 fix(vscode): 添加 cSpell 配置支持 struc 词汇 refactor(session): 移除过时的会话管理方法 移除了基于单一字符串键的会话管理方法,因为已迁移到使用 复合键的缓存操作方式 ```
43 lines
646 B
Go
43 lines
646 B
Go
package service
|
|
|
|
import (
|
|
"blazing/cool"
|
|
"blazing/modules/player/model"
|
|
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
)
|
|
|
|
type CdkService struct {
|
|
BaseService
|
|
}
|
|
|
|
func (s *CdkService) CanGet(id uint32) bool {
|
|
m1, _ := s.TestModel(s.Model).Where("code_id", id).Exist()
|
|
|
|
return !m1
|
|
|
|
}
|
|
|
|
func (s *CdkService) Log(id uint32) {
|
|
m := s.TestModel(s.Model)
|
|
data := g.Map{
|
|
"player_id": s.userid,
|
|
"code_id": id,
|
|
"is_vip": cool.Config.ServerInfo.IsVip,
|
|
}
|
|
|
|
m.Data(data).Insert()
|
|
|
|
}
|
|
|
|
func NewCdkService(id uint32) *CdkService {
|
|
return &CdkService{
|
|
|
|
BaseService: BaseService{userid: id,
|
|
|
|
Service: &cool.Service{Model: model.NewCdkLog()},
|
|
},
|
|
}
|
|
|
|
}
|