1
This commit is contained in:
@@ -160,17 +160,6 @@ func (s *InfoService) Gensession() string {
|
||||
// // 解码UUID字符串为字节数组(32位十六进制字符串对应16字节)
|
||||
uuidBytes, _ := hex.DecodeString(uuidStr)
|
||||
|
||||
// // 将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)...)
|
||||
|
||||
// // 编码为十六进制字符串作为最终会话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))
|
||||
|
||||
Reference in New Issue
Block a user