refactor(socket): 优化TCP数据包处理逻辑并增加调试日志

- 修复 handleTcp 中条件判断的空格格式问题
- 在解码失败时增加详细 Debug 日志输出
- 完善不完整数据包时手动唤醒连接的处理流程

refactor(pet): 重构宠物经验系统与升级逻辑

- 将经验计算函数移至 model 层统一管理
- 优化 AddPetExp 方法逻辑,避免直接修改原字段
- 升级过程中正确扣减经验池并防止溢出
- 抽离 Update 方法用于处理宠物进化和经验更新

refactor(model): 调整 PlayerInfo 结构体引用方式及相关初始化逻辑

- 修改 PlayerEX 中 Data 字段为值类型而非指针
- 更新 NewPlayerInfo 返回值为值类型
- 修正 defaults.Set 调用传参以适配结构体值类型

refactor(service): 统一 UserService 数据传递方式

- 修复 Person 方法返回值为指针类型
- 修复 Save 方法中赋值操作使用解引用方式
```
This commit is contained in:
2025-10-19 01:43:40 +08:00
parent 2ca0898b15
commit 7de149d946
2 changed files with 8 additions and 12 deletions

View File

@@ -60,7 +60,6 @@ func (codec TomeeSocketCodec) Decode(c gnet.Conn) ([]byte, error) {
if bodyLen > maxBodyLen {
return nil, errors.New("packet body exceeds max length")
}
totalLen := 4 + int(bodyLen)
// 检查整个包是否完整
buf, err := c.Peek(int(bodyLen))
@@ -76,7 +75,7 @@ func (codec TomeeSocketCodec) Decode(c gnet.Conn) ([]byte, error) {
copy(body, buf)
// 从缓冲区中丢弃已读取的数据
_, _ = c.Discard(totalLen)
_, _ = c.Discard(4 + int(bodyLen))
return body, nil
}