feat(config): 增加服务器在线状态检测功能

- 在ServerEvent中添加OnlineID到日志输出
- 修改玩家宠物闪光逻辑,仅在ShinyInfo为空时添加新闪光信息
- 在server.go中增加PageQueryOp配置,实现服务器假踢人功能
- 添加在线状态检测逻辑,通过GetClient获取连接状态并更新服务器列表
- 引入context、g和gconv依赖包用于服务逻辑处理
```
This commit is contained in:
2026-01-08 03:55:24 +08:00
parent 174562b895
commit 97dfc61939
5 changed files with 28 additions and 2 deletions

View File

@@ -4,11 +4,14 @@ import (
"blazing/cool"
"blazing/modules/config/model"
"bufio"
"context"
"fmt"
"os"
"sort"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/util/gconv"
"github.com/qiniu/go-sdk/v7/auth/qbox"
"github.com/qiniu/go-sdk/v7/storage"
"golang.org/x/crypto/ssh"
@@ -24,6 +27,29 @@ func NewServerService() *ServerService {
cf := &ServerService{
Service: &cool.Service{
Model: model.NewServerList(),
PageQueryOp: &cool.QueryOp{
ModifyResult: func(ctx g.Ctx, data interface{}) interface{} {
r, _ := gconv.Map(data)["list"].(gdb.Result)
for _, v := range r {
t, ok := cool.GetClient(gconv.Uint16(v.Map()["online_id"]))
if ok {
cool.Logger.Info(context.TODO(), "服务器假踢人")
err := t.KickPerson(0) //实现指定服务器踢人
if err == nil {
// tt.Friends = v.Friends
v.GMap().Set("isonline", 1)
}
}
}
return data
},
},
},
}
cfg := storage.Config{