获取随机在线玩家数据bug

This commit is contained in:
meixiongfeng 2022-10-20 16:16:38 +08:00
parent a60a40d760
commit 9dd2ae45cf
2 changed files with 5 additions and 2 deletions

View File

@ -33,5 +33,8 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.GourmetGetListRe
this.module.modelGourmet.CalculationGourmet(session.GetUserId(), _gourmet)
session.SendMsg(string(this.module.GetType()), GourmetGetListResp, &pb.GourmetGetListResp{Data: _gourmet})
// this.GetRandUser(session, &pb.GourmetGetRandUserReq{
// People: 10,
// })
return
}

View File

@ -50,8 +50,8 @@ func (this *apiComp) GetRandUser(session comm.IUserSession, req *pb.GourmetGetRa
if len(onlineList) > int(req.People) {
randArr := utils.Numbers(0, len(onlineList), int(req.People))
for _, v := range randArr {
if szUid[v] != "" {
randOnlineUsers = append(randOnlineUsers, szUid[v])
if onlineList[v].Uid != "" {
randOnlineUsers = append(randOnlineUsers, onlineList[v].Uid)
}
}
} else { // 数量不足 则有多少给多少