feat(common): 重构数据包处理逻辑并添加全局 ID 生成器

- 引入 idgenerator-go 库,实现全局唯一 ID 生成
- 重构 Pack 函数,使用接口参数提高灵活性
- 修改 Player 结构,增加 MainConn 字段用于主连接
- 更新 SocketHandler_Tomee 中的 Data 字段标记
- 优化 Recv 函数中的数据解包和参数处理逻辑
This commit is contained in:
2025-06-27 22:40:49 +08:00
parent e25fe776eb
commit 741ef6ebd4
19 changed files with 214 additions and 94 deletions

View File

@@ -16,7 +16,7 @@ type TomeeHeader struct {
//Error uint32 `json:"error" struc:"[0]pad"`
Result uint32 `json:"result"`
Data []byte `json:"data" struc:"[0]pad"` //组包忽略此字段// struc:"[0]pad"
Data []byte `json:"data"|struc:"skip"` //组包忽略此字段// struc:"[0]pad"
}
type TomeeHandler struct {
Callback func(conn gnet.Conn, data TomeeHeader)