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 }