From 4f5820535a84bc9b01cc353557a8c494af4c0715 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Sun, 4 Feb 2024 15:53:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B2=A1=E7=94=A8=E5=9C=A8=E7=BA=BF=E7=8E=A9?= =?UTF-8?q?=E5=AE=B6=E5=9C=A8=E7=9A=84=E6=97=B6=E5=80=99=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/friend/api_cross_randlist.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/modules/friend/api_cross_randlist.go b/modules/friend/api_cross_randlist.go index b910f327f..b5f4da04e 100644 --- a/modules/friend/api_cross_randlist.go +++ b/modules/friend/api_cross_randlist.go @@ -35,18 +35,16 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR } //在线玩家列表 - onlines, err = this.module.ModuleUser.UserRandOnlineList(10) - if err != nil { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_DBError, - Title: pb.ErrorCode_DBError.ToString(), - Message: err.Error(), - } + onlines, _ = this.module.ModuleUser.UserRandOnlineList(10) + // 在线玩家为0 直接返回 + if len(onlines) == 0 { + session.SendMsg(string(this.module.GetType()), FriendSubTypeRandList, &pb.FriendRandlistResp{}) return } for _, v := range onlines { userids = append(userids, v.Uid) } + //检查目标v中的申请列表中是否有自己, friends, err = this.module.modelFriend.GetFriends(userids) if err != nil {