From b7475644fe71170df835ba628d178851a6971959 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Sun, 5 Jan 2025 00:50:03 +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 | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/consume/egg_canal_user_down_consume.go b/consume/egg_canal_user_down_consume.go index 1efe6bf..9e57c7b 100644 --- a/consume/egg_canal_user_down_consume.go +++ b/consume/egg_canal_user_down_consume.go @@ -58,11 +58,19 @@ func handleEggCanalUserDownConsume(msgData []byte) error { engine := db.Db NewUserDb := implement.NewUserDb(engine) user, _ := NewUserDb.GetUser(utils.StrToInt64(msg.Uid)) + if user == nil { + return nil + } levelDb := implement.NewUserLevelDb(engine) levelAll, _ := levelDb.UserLevelAllByAsc() level := 1 - if len(levelAll) > 0 { - level = levelAll[0].Id + if len(levelAll) == 0 { + return nil + + } + level = levelAll[0].Id + if levelAll[0].Id == user.Level { + return nil } sort.Slice(levelAll, func(i, j int) bool { return levelAll[i].LevelWeight > levelAll[j].LevelWeight