Browse Source

升级

withdrawal
huangjiajun 4 days ago
parent
commit
e843d0b0c9
1 changed files with 6 additions and 6 deletions
  1. +6
    -6
      consume/egg_canal_user_down_consume.go

+ 6
- 6
consume/egg_canal_user_down_consume.go View File

@@ -30,7 +30,7 @@ func EggCanalUserDownConsume(queue md.MqQueue) {
//1、将自己绑定到交换机上 //1、将自己绑定到交换机上
ch.Bind(queue.Name, queue.ExchangeName, queue.RoutKey) ch.Bind(queue.Name, queue.ExchangeName, queue.RoutKey)
//2、取出数据进行消费 //2、取出数据进行消费
ch.Qos(1)
ch.Qos(100)
delivery := ch.Consume(queue.Name, false) delivery := ch.Consume(queue.Name, false)


egg_system_rules.Init(cfg.RedisAddr) egg_system_rules.Init(cfg.RedisAddr)
@@ -68,6 +68,7 @@ func handleEggCanalUserDownConsume(msgData []byte, ch *rabbit.Channel) error {
return nil return nil
} }
level = levelAll[0].Id level = levelAll[0].Id
firstLevel := levelAll[0].Id
if levelAll[0].Id == user.Level { if levelAll[0].Id == user.Level {
return nil return nil
} }
@@ -81,11 +82,14 @@ func handleEggCanalUserDownConsume(msgData []byte, ch *rabbit.Channel) error {
isHas = 1 isHas = 1
} }
if isHas == 1 { if isHas == 1 {
if firstLevel == v.Id {
level = v.Id
continue
}
task, err = rule.UserUpgradeTask(engine, int(user.Id), v.Id) task, err = rule.UserUpgradeTask(engine, int(user.Id), v.Id)
if err != nil { if err != nil {
continue continue
} }
level = v.Id
} }
} }
//升级 //升级
@@ -103,9 +107,5 @@ func handleEggCanalUserDownConsume(msgData []byte, ch *rabbit.Channel) error {
Task: utils.SerializeStr(task), Task: utils.SerializeStr(task),
} }
engine.Insert(&tmp) engine.Insert(&tmp)
msg1 := md.CommUserId{
Uid: utils.Int64ToStr(user.Id),
}
ch.Publish("egg.user", msg1, "egg_canal_user_down")
return nil return nil
} }

Loading…
Cancel
Save