```
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

fix(player): 修复玩家ID记录错误

当处理客户端消息时发生panic错误,日志中记录的玩家ID应该是当前客户端数据中的
玩家ID(cd.Player.Info.UserID),而不是错误引用的h.Player.Info.UserID。

这确保了错误日志能够正确关联到实际出错的玩家。
```
This commit is contained in:
昔念
2026-03-04 01:38:24 +08:00
parent 536a0c45c8
commit aefef6a456

View File

@@ -107,7 +107,7 @@ func (cd *ClientData) consumeMsg() {
// 1. 打印错误信息
if cd.Player != nil {
if cd.Player.Info != nil {
cool.Logger.Error(context.TODO(), "panic 错误:", cool.Config.ServerInfo.OnlineID, h.Player.Info.UserID, err)
cool.Logger.Error(context.TODO(), "panic 错误:", cool.Config.ServerInfo.OnlineID, cd.Player.Info.UserID, err)
} else {
cool.Logger.Error(context.TODO(), "panic 错误:", cool.Config.ServerInfo.OnlineID, err)