From b0b9f0865c41b10fbcae98ab115ffbaf33c18f31 Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Wed, 8 Feb 2023 14:13:35 +0800 Subject: [PATCH] add log --- cmd/v2/FyneApp.toml | 4 ++-- modules/friend/api_cross_randlist.go | 9 ++++++++- modules/user/module.go | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/cmd/v2/FyneApp.toml b/cmd/v2/FyneApp.toml index 7add2c04c..3b502ba60 100644 --- a/cmd/v2/FyneApp.toml +++ b/cmd/v2/FyneApp.toml @@ -4,5 +4,5 @@ Website = "http://legu.cc" Icon = "app.png" Name = "RobotGUI" ID = "cc.legu.app" - Version = "1.2.8" - Build = 38 + Version = "1.2.9" + Build = 39 diff --git a/modules/friend/api_cross_randlist.go b/modules/friend/api_cross_randlist.go index cf42d38d5..eb17f81a2 100644 --- a/modules/friend/api_cross_randlist.go +++ b/modules/friend/api_cross_randlist.go @@ -2,6 +2,7 @@ package friend import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "go_dreamfactory/utils" @@ -30,6 +31,10 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR return } + this.moduleFriend.Debug("在线玩家数", + log.Field{Key: "uid", Value: session.GetUserId()}, + log.Field{Key: "count", Value: len(cuList)}) + recommend := 5 //推荐数量 //过滤 var newList []*pb.CacheUser @@ -59,6 +64,9 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR } newList = append(newList, v) } + this.moduleFriend.Debug("过滤后的玩家数", + log.Field{Key: "uid", Value: session.GetUserId()}, + log.Field{Key: "count", Value: len(newList)}) var randOnlineUsers []string if len(newList) > recommend { @@ -79,7 +87,6 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR var userList []*pb.FriendBase for _, uid := range randOnlineUsers { - target := this.moduleFriend.modelFriend.GetFriend(uid) if target == nil { continue diff --git a/modules/user/module.go b/modules/user/module.go index 29db3a3db..bf103846d 100644 --- a/modules/user/module.go +++ b/modules/user/module.go @@ -189,6 +189,7 @@ func (this *User) CrossUserOnlineList() ([]*pb.CacheUser, error) { if err := model.GetList(comm.RDS_EMPTY, &cache); err != nil { return nil, err } + this.Debug("在线玩家数FromDB", log.Field{Key: "count", Value: len(cache)}) return cache, nil // reply := &pb.UserOnlineResp{}