修复在线用户跳动

pull/30/head
taoshihan1991 4 years ago
parent 3af3088b85
commit 4a65dd5a7a

@ -6,6 +6,7 @@ import (
"github.com/gorilla/websocket"
"github.com/taoshihan1991/imaptool/models"
"log"
"sort"
"time"
)
type vistor struct{
@ -130,7 +131,13 @@ func sendPingUpdateStatus() {
func sendPingOnlineUsers() {
for {
result := make([]map[string]string, 0)
for _, user := range clientList {
var visitorIds []string
for visitorId, _ := range clientList {
visitorIds=append(visitorIds,visitorId)
}
sort.Strings(visitorIds)
for _,visitorId:=range visitorIds{
user:=clientList[visitorId]
userInfo := make(map[string]string)
userInfo["uid"] = user.id
userInfo["username"] = user.name

Loading…
Cancel
Save