playroom推荐优化
This commit is contained in:
parent
2677c1c7bc
commit
d77a9f7e43
@ -656,21 +656,27 @@ func GetVisitorPlayer(p *Player) int {
|
||||
PlayroomMod := p.PlayMod.getPlayroomMod()
|
||||
VisitorList := PlayroomMod.GetVisitor()
|
||||
HasVisit := PlayroomMod.GetHasVisit()
|
||||
FriendMod := p.PlayMod.getFriendMod()
|
||||
type sortData struct {
|
||||
Uid int
|
||||
Time int64
|
||||
}
|
||||
PlayerList := make([]sortData, 0)
|
||||
|
||||
PlayerList2 := make([]sortData, 0)
|
||||
Now := GoUtil.Now()
|
||||
for k, v := range VisitorList {
|
||||
if _, ok := HasVisit[k]; ok {
|
||||
continue
|
||||
}
|
||||
|
||||
if v.Time < Now-86400 {
|
||||
continue
|
||||
}
|
||||
if FriendMod.CheckFriend(k) {
|
||||
PlayerList = append(PlayerList, sortData{k, v.Time})
|
||||
} else {
|
||||
PlayerList2 = append(PlayerList, sortData{k, v.Time})
|
||||
}
|
||||
}
|
||||
if len(PlayerList) != 0 {
|
||||
sort.Slice(PlayerList, func(i, j int) bool {
|
||||
@ -678,13 +684,6 @@ func GetVisitorPlayer(p *Player) int {
|
||||
})
|
||||
return PlayerList[0].Uid
|
||||
}
|
||||
FriendMod := p.PlayMod.getFriendMod()
|
||||
PlayerList2 := make([]sortData, 0)
|
||||
for _, v := range PlayerList {
|
||||
if FriendMod.CheckFriend(v.Uid) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if len(PlayerList2) != 0 {
|
||||
sort.Slice(PlayerList2, func(i, j int) bool {
|
||||
return PlayerList2[i].Time < PlayerList2[j].Time
|
||||
|
||||
Loading…
Reference in New Issue
Block a user