|
|
@@ -30,7 +30,7 @@ func EggCanalUserDownConsume(queue md.MqQueue) { |
|
|
|
//1、将自己绑定到交换机上 |
|
|
|
ch.Bind(queue.Name, queue.ExchangeName, queue.RoutKey) |
|
|
|
//2、取出数据进行消费 |
|
|
|
ch.Qos(1) |
|
|
|
ch.Qos(100) |
|
|
|
delivery := ch.Consume(queue.Name, false) |
|
|
|
|
|
|
|
egg_system_rules.Init(cfg.RedisAddr) |
|
|
@@ -68,6 +68,7 @@ func handleEggCanalUserDownConsume(msgData []byte, ch *rabbit.Channel) error { |
|
|
|
return nil |
|
|
|
} |
|
|
|
level = levelAll[0].Id |
|
|
|
firstLevel := levelAll[0].Id |
|
|
|
if levelAll[0].Id == user.Level { |
|
|
|
return nil |
|
|
|
} |
|
|
@@ -81,11 +82,14 @@ func handleEggCanalUserDownConsume(msgData []byte, ch *rabbit.Channel) error { |
|
|
|
isHas = 1 |
|
|
|
} |
|
|
|
if isHas == 1 { |
|
|
|
if firstLevel == v.Id { |
|
|
|
level = v.Id |
|
|
|
continue |
|
|
|
} |
|
|
|
task, err = rule.UserUpgradeTask(engine, int(user.Id), v.Id) |
|
|
|
if err != nil { |
|
|
|
continue |
|
|
|
} |
|
|
|
level = v.Id |
|
|
|
} |
|
|
|
} |
|
|
|
//升级 |
|
|
@@ -103,9 +107,5 @@ func handleEggCanalUserDownConsume(msgData []byte, ch *rabbit.Channel) 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 |
|
|
|
} |