好友搜索优化
This commit is contained in:
parent
4de86e2d61
commit
9e3d8e5f39
@ -1411,8 +1411,19 @@ func ReqSearchPlayer(player *Player, buf []byte) error {
|
|||||||
list = append(list, SearchPlayer)
|
list = append(list, SearchPlayer)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// list 列表去重
|
||||||
|
l := make(map[int]*msg.ResPlayerSimple)
|
||||||
|
for _, v := range list {
|
||||||
|
if _, ok := l[int(v.Uid)]; !ok {
|
||||||
|
l[int(v.Uid)] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
l2 := make([]*msg.ResPlayerSimple, 0)
|
||||||
|
for _, v := range l {
|
||||||
|
l2 = append(l2, v)
|
||||||
|
}
|
||||||
player.PushClientRes(&msg.ResSearchPlayer{
|
player.PushClientRes(&msg.ResSearchPlayer{
|
||||||
List: list,
|
List: l2,
|
||||||
})
|
})
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user