海岛数据过滤
This commit is contained in:
parent
2dac1c1733
commit
b0d14854e2
@ -51,6 +51,8 @@ func (this *modelLand) createPlunderLandData(uid string) (land *pb.DBPlunderLand
|
|||||||
uids []string
|
uids []string
|
||||||
users []*pb.DBUser
|
users []*pb.DBUser
|
||||||
info []*pb.DBPlunder
|
info []*pb.DBPlunder
|
||||||
|
join map[string]struct{}
|
||||||
|
curUids []string // 过滤后的玩家
|
||||||
)
|
)
|
||||||
land = &pb.DBPlunderLand{
|
land = &pb.DBPlunderLand{
|
||||||
Id: primitive.NewObjectID().Hex(),
|
Id: primitive.NewObjectID().Hex(),
|
||||||
@ -75,14 +77,21 @@ func (this *modelLand) createPlunderLandData(uid string) (land *pb.DBPlunderLand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 批量查
|
join = make(map[string]struct{})
|
||||||
|
// 批量查 是否有加入海岛的
|
||||||
info, _ = this.module.modelPlunder.getPlunderDataByUids(uids)
|
info, _ = this.module.modelPlunder.getPlunderDataByUids(uids)
|
||||||
for i, v := range info {
|
for _, v := range info {
|
||||||
if v.Landid != "" { // 过滤
|
if v.Landid != "" { // 过滤
|
||||||
uids = append(uids[:i], uids[i+1:]...)
|
join[v.Uid] = struct{}{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if users, err = this.module.ModuleUser.GetCrossUsers(uids); err != nil {
|
|
||||||
|
for _, v := range uids { // 过滤已经加入海岛的玩家
|
||||||
|
if _, ok := join[v]; !ok {
|
||||||
|
curUids = append(curUids, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if users, err = this.module.ModuleUser.GetCrossUsers(curUids); err != nil {
|
||||||
for _, v := range users {
|
for _, v := range users {
|
||||||
land.Uinfo[v.Uid] = comm.GetUserBaseInfo(v)
|
land.Uinfo[v.Uid] = comm.GetUserBaseInfo(v)
|
||||||
if len(land.Uinfo) > 20 {
|
if len(land.Uinfo) > 20 {
|
||||||
|
Loading…
Reference in New Issue
Block a user