feat(rpc): 设置默认RPC地址为本地回环

修复RPC客户端连接问题,将默认服务器地址设置为127.0.0.1以确保本地连接正常

refactor(qqwry): 优化IP地址查询功能

移除不必要的正则表达式依赖,重构IP地址查询逻辑,提高代码性能和可维护性

fix(server): 保存确定的端口到配置中

确保服务器端口在确定后正确保存到配置中,避免端口配置丢失
This commit is contained in:
2026-01-08 05:15:10 +08:00
parent 56fe334045
commit 4d0464c76b
8 changed files with 116 additions and 164 deletions

View File

@@ -29,24 +29,29 @@ func NewServerService() *ServerService {
Model: model.NewServerList(),
PageQueryOp: &cool.QueryOp{
ModifyResult: func(ctx g.Ctx, data interface{}) interface{} {
var rr []g.MapStrAny
r, _ := gconv.Map(data)["list"].(gdb.Result)
for _, v := range r {
t, ok := cool.GetClient(gconv.Uint16(v.Map()["port"]))
for i := 0; i < len(r); i++ {
t, ok := cool.GetClient(gconv.Uint16(r[i].Map()["port"]))
// tt.Friends = v.Friends
subm := r[i].GMap()
if ok {
cool.Logger.Info(context.TODO(), "服务器假踢人")
err := t.KickPerson(0) //实现指定服务器踢人
if err == nil {
// tt.Friends = v.Friends
v.GMap().Set("isonline", 1)
subm.Set("isonline", 1)
}
}
rr = append(rr, subm.MapStrAny())
}
data.(map[string]interface{})["list"] = rr
return data
},
},