根据提供的code differences信息,我无法看到具体的代码变更内容,因此无法生成准确的commit message。请提供具体的代码差异信息。
不过,我可以提供一个符合Angular规范的中文commit message模板: ``` feat(scope): 新增功能描述 - 具体的功能点说明 - 变更的详细描述 - 影响的模块或组件 ``` 或者: ``` fix(scope): 修复问题描述 - 问题的具体表现 - 解决
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
"blazing/modules/config/service"
|
||||
"blazing/modules/player/model"
|
||||
"context"
|
||||
"encoding/binary"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
|
||||
@@ -31,9 +30,9 @@ func (s *InfoService) IsReg() bool {
|
||||
}
|
||||
|
||||
// 实现注册,id+昵称+颜色
|
||||
func (s *InfoService) Reg(nick string, color uint32) {
|
||||
func (s *InfoService) Reg(nick string, color uint32) *model.PlayerInfo {
|
||||
if s.IsReg() {
|
||||
return
|
||||
return nil
|
||||
}
|
||||
|
||||
t := model.NewPlayer()
|
||||
@@ -48,9 +47,9 @@ func (s *InfoService) Reg(nick string, color uint32) {
|
||||
_, err := cool.DBM(s.Model).Data(t).FieldsEx("id").Insert()
|
||||
if err != nil {
|
||||
glog.Error(context.Background(), err)
|
||||
return
|
||||
|
||||
}
|
||||
//go s.InitTask()
|
||||
return &t.Data
|
||||
}
|
||||
|
||||
func (s *InfoService) Person(userid uint32) (out *model.PlayerEX) {
|
||||
@@ -62,7 +61,7 @@ func (s *InfoService) Person(userid uint32) (out *model.PlayerEX) {
|
||||
}
|
||||
func (s *InfoService) GetCache() *model.PlayerInfo {
|
||||
|
||||
ret, _ := cool.CacheManager.Get(context.TODO(), fmt.Sprintf("player: %d", s.userid))
|
||||
ret, _ := cool.CacheManager.Get(context.TODO(), fmt.Sprintf("player:%d", s.userid))
|
||||
if ret == nil {
|
||||
return nil
|
||||
}
|
||||
@@ -130,23 +129,24 @@ func (s *InfoService) Gensession() string {
|
||||
// 移除UUID中的连字符,便于后续处理
|
||||
uuidStr := strings.ReplaceAll(uuidV7.String(), "-", "")
|
||||
|
||||
// 解码UUID字符串为字节数组(32位十六进制字符串对应16字节)
|
||||
// // 解码UUID字符串为字节数组(32位十六进制字符串对应16字节)
|
||||
uuidBytes, _ := hex.DecodeString(uuidStr)
|
||||
|
||||
// 将accountID转换为4字节大端序字节数组
|
||||
accountBytes := make([]byte, 4)
|
||||
binary.BigEndian.PutUint32(accountBytes, uint32(s.userid))
|
||||
// // 将accountID转换为4字节大端序字节数组
|
||||
// accountBytes := make([]byte, 4)
|
||||
// binary.BigEndian.PutUint32(accountBytes, uint32(s.userid))
|
||||
|
||||
// 预分配缓冲区(总长度:4+16+4=24字节),减少内存分配
|
||||
sessionBytes := make([]byte, 0, 24)
|
||||
sessionBytes = append(sessionBytes, accountBytes...)
|
||||
sessionBytes = append(sessionBytes, uuidBytes...)
|
||||
//sessionBytes = append(sessionBytes, grand.B(4)...)
|
||||
// // 预分配缓冲区(总长度:4+16+4=24字节),减少内存分配
|
||||
// sessionBytes := make([]byte, 0, 24)
|
||||
// sessionBytes = append(sessionBytes, accountBytes...)
|
||||
// sessionBytes = append(sessionBytes, uuidBytes...)
|
||||
// //sessionBytes = append(sessionBytes, grand.B(4)...)
|
||||
|
||||
// 编码为十六进制字符串作为最终会话ID
|
||||
sessionID := hex.EncodeToString(sessionBytes)
|
||||
User.Store(string(uuidStr), uint32(s.userid))
|
||||
//share.ShareManager.SaveSession(string(uuidStr), uint32(s.userid))
|
||||
// // 编码为十六进制字符串作为最终会话ID
|
||||
sessionID := hex.EncodeToString(uuidBytes)
|
||||
cool.CacheManager.Set(context.Background(), fmt.Sprintf("session:%d", uint32(s.userid)), sessionID, 0)
|
||||
// ///User.Store(string(uuidStr), uint32(s.userid))
|
||||
// //share.ShareManager.SaveSession(string(uuidStr), uint32(s.userid))
|
||||
return sessionID
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user