From 0cd66da4b3958e742f4e97c05b14e361e6a84979 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Sun, 5 Jan 2025 00:51:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- consume/egg_canal_user_down_consume.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/consume/egg_canal_user_down_consume.go b/consume/egg_canal_user_down_consume.go index 9e57c7b..8ad48bb 100644 --- a/consume/egg_canal_user_down_consume.go +++ b/consume/egg_canal_user_down_consume.go @@ -39,7 +39,7 @@ func EggCanalUserDownConsume(queue md.MqQueue) { for { res, ok = <-delivery if ok == true { - err = handleEggCanalUserDownConsume(res.Body) + err = handleEggCanalUserDownConsume(res.Body, ch) err = res.Ack(true) fmt.Println("err ::: ", err) } else { @@ -49,7 +49,7 @@ func EggCanalUserDownConsume(queue md.MqQueue) { fmt.Println("get msg done") } -func handleEggCanalUserDownConsume(msgData []byte) error { +func handleEggCanalUserDownConsume(msgData []byte, ch *rabbit.Channel) error { var msg *md.CommUserId err := json.Unmarshal(msgData, &msg) if err != nil { @@ -66,7 +66,6 @@ func handleEggCanalUserDownConsume(msgData []byte) error { level := 1 if len(levelAll) == 0 { return nil - } level = levelAll[0].Id if levelAll[0].Id == user.Level { @@ -104,5 +103,9 @@ func handleEggCanalUserDownConsume(msgData []byte) error { Task: utils.SerializeStr(task), } engine.Insert(&tmp) + msg1 := md.CommUserId{ + Uid: utils.Int64ToStr(user.Id), + } + ch.Publish("egg.user", msg1, "egg_canal_user_down") return nil }