|
|
|
@ -2,6 +2,7 @@ package task
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
|
"context" |
|
|
|
|
livev1 "git.gz.internal.jumaiyx.cn/jm/jmproto/live/v1" |
|
|
|
|
v2 "git.gz.internal.jumaiyx.cn/jm/jmproto/room/v2" |
|
|
|
|
"git.gz.internal.jumaiyx.cn/pkg/client" |
|
|
|
|
configv2 "git.gz.internal.jumaiyx.cn/pkg/config/v2" |
|
|
|
@ -79,14 +80,35 @@ func task(start, end int64) error {
|
|
|
|
|
if err != nil { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
liveClient, liveClientClose, err := client.GetLiveClient(context.Background()) |
|
|
|
|
if err != nil { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
defer func() { _ = liveClientClose() }() |
|
|
|
|
|
|
|
|
|
onlineTotalResp, err := liveClient.GetLiveOnlineTotal(context.Background(), &livev1.GetLiveOnlineTotalReq{ |
|
|
|
|
RoomIdList: ids, |
|
|
|
|
}) |
|
|
|
|
if err != nil { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
roomClient, roomClientClose, err := client.GetRoomClientV2(context.Background()) |
|
|
|
|
if err != nil { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
defer func() { _ = roomClientClose() }() |
|
|
|
|
onlineMap := onlineTotalResp.Items |
|
|
|
|
var items []*v2.IncrRoomHotspotReq_Item |
|
|
|
|
for _, id := range ids { |
|
|
|
|
online := onlineMap[id] |
|
|
|
|
items = append(items, &v2.IncrRoomHotspotReq_Item{ |
|
|
|
|
RoomId: id, |
|
|
|
|
HotValue: int32(online) * 10, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
_, err = roomClient.IncrRoomHotspot(context.Background(), &v2.IncrRoomHotspotReq{ |
|
|
|
|
RoomIdList: ids, |
|
|
|
|
HotValue: 0, |
|
|
|
|
Items: items, |
|
|
|
|
}) |
|
|
|
|
if err != nil { |
|
|
|
|
return err |
|
|
|
|