This commit is contained in:
@@ -51,7 +51,7 @@ func (h *ClientData) Recv(data common.TomeeHeader) {
|
||||
if err := recover(); err != nil { // 恢复 panic,err 为 panic 错误值
|
||||
// 1. 打印错误信息
|
||||
|
||||
cool.Logger.Error(context.TODO(), "panic 错误:", err)
|
||||
cool.Logger.Error(context.TODO(), "Recv 错误:", err)
|
||||
|
||||
}
|
||||
}()
|
||||
@@ -151,7 +151,7 @@ func NewClientData(c gnet.Conn) *ClientData {
|
||||
Conn: c,
|
||||
Wsmsg: &WsCodec{},
|
||||
}
|
||||
cd.LF = lockfree.NewLockfree[common.TomeeHeader](
|
||||
cd.LF = lockfree.NewLockfree(
|
||||
8,
|
||||
cd,
|
||||
lockfree.NewConditionBlockStrategy(),
|
||||
@@ -205,14 +205,14 @@ func (h *ClientData) OnEvent(t common.TomeeHeader) {
|
||||
// 1. 打印错误信息
|
||||
if h.Player != nil {
|
||||
if h.Player.Info != nil {
|
||||
cool.Logger.Error(context.TODO(), "panic 错误:", h.Player.Info.UserID, err)
|
||||
cool.Logger.Error(context.TODO(), "OnEvent 错误:", h.Player.Info.UserID, err)
|
||||
} else {
|
||||
cool.Logger.Error(context.TODO(), "panic 错误:", err)
|
||||
cool.Logger.Error(context.TODO(), "OnEvent 错误:", err)
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
cool.Logger.Error(context.TODO(), "panic 错误:", err)
|
||||
cool.Logger.Error(context.TODO(), "OnEvent 错误:", err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ func (p *Player) GetCoins(amount uint32) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (p *Player) UseGold(amount uint32) bool {
|
||||
func (p *Player) UseGold(amount int64) bool {
|
||||
if p.User.GetGold(uint(p.Info.UserID)) < amount {
|
||||
return false
|
||||
}
|
||||
@@ -183,7 +183,7 @@ func (p *Player) SendPack(b []byte) error {
|
||||
return fmt.Errorf("链接错误,取消发包")
|
||||
|
||||
}
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
// 添加物品 返回成功添加的物品
|
||||
|
||||
Reference in New Issue
Block a user