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