From 7d42712db2fa490b8763183fecb1c0e291b80f7a Mon Sep 17 00:00:00 2001 From: otto <965391514@qq.com> Date: Mon, 15 Apr 2024 17:46:54 +0800 Subject: [PATCH 1/3] up --- go.mod | 2 +- task/task.go | 26 ++++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index a16c51b..5048276 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module git.gz.internal.jumaiyx.cn/job/hotspot-clear go 1.20 require ( - git.gz.internal.jumaiyx.cn/jm/jmproto v0.0.0-20240321070012-9ad2cc15ec1c + git.gz.internal.jumaiyx.cn/jm/jmproto v0.0.0-20240415093446-0004fca23b7b git.gz.internal.jumaiyx.cn/pkg/client v0.0.0-20231123090823-91017d7a1a1e git.gz.internal.jumaiyx.cn/pkg/config/v2 v2.0.0-20240312130125-0f8bbcc94011 git.gz.internal.jumaiyx.cn/pkg/k8s-client/v2 v2.0.3-0.20240229083126-a1abe7ddc19f diff --git a/task/task.go b/task/task.go index 0c76cc5..720bd4d 100644 --- a/task/task.go +++ b/task/task.go @@ -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 From f968845fae4a1ef36f7d8d9829c8b9c2e9d91deb Mon Sep 17 00:00:00 2001 From: otto <965391514@qq.com> Date: Mon, 15 Apr 2024 17:49:22 +0800 Subject: [PATCH 2/3] up --- hotspot-clear-job-dev.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot-clear-job-dev.yaml b/hotspot-clear-job-dev.yaml index e31f73c..1cc2b9e 100644 --- a/hotspot-clear-job-dev.yaml +++ b/hotspot-clear-job-dev.yaml @@ -12,7 +12,7 @@ spec: spec: containers: - name: hotspot-clear - image: 192.168.1.131:8888/job/dev/hotspot-clear:bb94dc6d3cec636650ca6685685c631936af7f36 + image: 192.168.1.131:8888/job/dev/hotspot-clear:7d42712db2fa490b8763183fecb1c0e291b80f7a env: - name: JM_ENVIRONMENT value: dev From e880a3248a950b095a40b79d4640f0e0f06a1f0c Mon Sep 17 00:00:00 2001 From: otto <965391514@qq.com> Date: Mon, 15 Apr 2024 17:51:27 +0800 Subject: [PATCH 3/3] up --- hotspot-clear-job-dev.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot-clear-job-dev.yaml b/hotspot-clear-job-dev.yaml index 1cc2b9e..d9eea79 100644 --- a/hotspot-clear-job-dev.yaml +++ b/hotspot-clear-job-dev.yaml @@ -4,7 +4,7 @@ metadata: name: hotspot-clear-job namespace: dev spec: - schedule: "*/10 * * * *" # 10分钟 + schedule: "*/5 * * * *" # 10分钟 # schedule: "0 * * * *" # 一小时 jobTemplate: spec: