"refactor(player): 添加错误检查方法并迁移任务测试代码到独立文件"

This commit is contained in:
1
2025-08-05 23:49:31 +00:00
parent 0f6c8d9329
commit a9dfe6aac5
4 changed files with 100 additions and 78 deletions

View File

@@ -5,6 +5,8 @@ import (
"fmt"
"sync"
"time"
"github.com/gogf/gf/v2/frame/g"
)
type Player struct {
@@ -50,6 +52,12 @@ func (p *Player) SendPack(b []byte) error {
err := p.MainConn.SendPack(b)
return err
}
func (p *Player) Cheak(b error) {
if b != nil {
g.Log().Error(context.Background(), "出现错误", p.UserID, b.Error())
}
}
// IsLoggedIn 检查是否已登录
func (lw *Player) IsLoggedIn() bool {