evt_online添加渠道信息

This commit is contained in:
sk 2024-04-25 13:34:23 +08:00
parent aa3a713699
commit ec635783c4
2 changed files with 5 additions and 13 deletions

View File

@ -9,16 +9,8 @@ import (
// GenerateOnline 在线统计
func GenerateOnline(online map[string]map[string]int) *RabbitMQData {
m := map[string]map[int]int{} // 渠道:平台:真人数
for k, v := range online {
m[k] = map[int]int{}
for k1, v1 := range v {
pf, _ := strconv.Atoi(k1)
m[k][pf] = v1
}
}
params := make(map[string]interface{})
params["Online"] = m
params["Online"] = online
params["Time"] = time.Now().Unix()
return NewRabbitMQData(mq.BackOnline, params)
}

View File

@ -32,12 +32,12 @@ func (p *PlayerOnlineEvent) Update() {
onlineCh := map[string]map[string]int{}
for _, player := range PlayerMgrSington.sidMap {
if player != nil && !player.IsRob && player.IsOnLine() {
info, ok := onlineCh[player.Channel]
info, ok := onlineCh[player.Platform]
if !ok {
onlineCh[player.Channel] = map[string]int{}
info = onlineCh[player.Channel]
onlineCh[player.Platform] = map[string]int{}
info = onlineCh[player.Platform]
}
info[player.Platform] += 1
info[player.Channel] += 1
}
}
if len(onlineCh) == len(p.OnlineCh) {