Browse Source

升级

master
huangjiajun 4 days ago
parent
commit
0cd66da4b3
1 changed files with 6 additions and 3 deletions
  1. +6
    -3
      consume/egg_canal_user_down_consume.go

+ 6
- 3
consume/egg_canal_user_down_consume.go View File

@@ -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
}

Loading…
Cancel
Save