优化接口报错

This commit is contained in:
hahwu 2026-02-26 10:04:20 +08:00
parent a10b2fefa7
commit 11f7b4960d

View File

@ -208,8 +208,10 @@ func HandleClientReq(args []interface{}) {
backup := p.(*Player).BackUp() // 备份当前的 Player 值
defer func() {
if r := recover(); r != nil {
log.Error("uid : %d, func : %s, fatal : %s", p.(*Player).M_DwUin, m.GetFunc(), r)
GoUtil.SendFeishuFatal(int(p.(*Player).M_DwUin), m.GetFunc(), fmt.Sprintf("fatal : %s", r))
if m.GetFunc() != "ReqGmCommand" { // 如果不是 GM 命令,才记录日志和发送飞书告警
log.Error("uid : %d, func : %s, fatal : %s", p.(*Player).M_DwUin, m.GetFunc(), r)
GoUtil.SendFeishuFatal(int(p.(*Player).M_DwUin), m.GetFunc(), fmt.Sprintf("fatal : %s", r))
}
p.(*Player).Recover(backup) //还原Player的数据
}
p.(*Player).lock.Unlock() //解锁