助战数据 过滤掉没有创建的玩家
This commit is contained in:
parent
fa5a27c603
commit
8dcb5b95c3
@ -48,18 +48,18 @@ func (this *apiComp) GetAssistHero(session comm.IUserSession, req *pb.FriendGetA
|
||||
}
|
||||
}
|
||||
leftCount = int32(comm.AssistHeroCount - len(list.Data))
|
||||
// localNum, _ := this.module.modelFriend.DB.CountDocuments(core.SqlTable(this.module.modelFriend.TableName), bson.M{})
|
||||
// randomIndex := comm.GetRandNum(0, int32(localNum))
|
||||
// cur, err := this.module.modelFriend.DB.Find(core.SqlTable(this.module.modelFriend.TableName), bson.M{"assistHeroId": bson.M{"$ne": ""}}, options.Find().SetSkip(int64(0)).SetLimit(int64(leftCount))) //.skip(1).limit(1)
|
||||
// for cur.Next(context.TODO()) {
|
||||
// tmp := &pb.DBFriend{}
|
||||
// if err = cur.Decode(tmp); err == nil {
|
||||
// if session.GetUserId() != tmp.Uid {
|
||||
// list.Data[tmp.Uid] = tmp.Info.Name
|
||||
// heros = append(heros, tmp.Hero)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//localNum, _ := this.module.modelFriend.DB.CountDocuments(core.SqlTable(this.module.modelFriend.TableName), bson.M{})
|
||||
//randomIndex := comm.GetRandNum(0, int32(localNum))
|
||||
cur, err := this.module.modelFriend.DB.Find(core.SqlTable(this.module.modelFriend.TableName), bson.M{"assistHeroId": bson.M{"$ne": ""}}, options.Find().SetSkip(int64(0)).SetLimit(int64(leftCount))) //.skip(1).limit(1)
|
||||
for cur.Next(context.TODO()) {
|
||||
tmp := &pb.DBFriend{}
|
||||
if err = cur.Decode(tmp); err == nil {
|
||||
if session.GetUserId() != tmp.Uid && tmp.Info != nil {
|
||||
list.Data[tmp.Uid] = tmp.Info.Name
|
||||
heros = append(heros, tmp.Hero)
|
||||
}
|
||||
}
|
||||
}
|
||||
err = this.module.modelAssist.Add(session.GetUserId(), list)
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), "getassisthero", &pb.FriendGetAssistHeroResp{
|
||||
@ -85,9 +85,12 @@ func (this *apiComp) GetAssistHero(session comm.IUserSession, req *pb.FriendGetA
|
||||
for cur.Next(context.TODO()) {
|
||||
tmp := &pb.DBFriend{}
|
||||
if err = cur.Decode(tmp); err == nil {
|
||||
if session.GetUserId() != tmp.Uid {
|
||||
list.Data[tmp.Uid] = tmp.Info.Name
|
||||
heros = append(heros, tmp.Hero)
|
||||
if session.GetUserId() != tmp.Uid && tmp.Info != nil {
|
||||
if tmp.Info != nil {
|
||||
list.Data[tmp.Uid] = tmp.Info.Name
|
||||
heros = append(heros, tmp.Hero)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ func (this *apiComp) RefreshAssistHero(session comm.IUserSession, req *pb.Friend
|
||||
for cur.Next(context.TODO()) {
|
||||
tmp := &pb.DBFriend{}
|
||||
if err = cur.Decode(tmp); err == nil {
|
||||
if session.GetUserId() != tmp.Uid {
|
||||
if session.GetUserId() != tmp.Uid && tmp.Info != nil {
|
||||
if int32(len(list.Data)) >= strangerCount {
|
||||
break
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user