From 25bbc2fa494f4ee8f8001ad23094243748aeff16 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Wed, 28 Feb 2024 18:31:37 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=B8=80=E4=B8=AA=E5=9C=88=E5=9C=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../one_circles_sign_in_green_energy_settlement.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/rule/one_circles/one_circles_sign_in_green_energy_settlement.go b/rule/one_circles/one_circles_sign_in_green_energy_settlement.go index 6b24ae0..0589d63 100644 --- a/rule/one_circles/one_circles_sign_in_green_energy_settlement.go +++ b/rule/one_circles/one_circles_sign_in_green_energy_settlement.go @@ -46,6 +46,7 @@ func SettlementSignInGreenEnergy(engine *xorm.Engine, masterId string, ch *rabbi break } + var ids []int64 for _, v := range list { //TODO::推入rabbitmq 异步处理 ch.Publish(md.OneCirclesExchange, md.OneCirclesStructForSignIn{ @@ -53,6 +54,13 @@ func SettlementSignInGreenEnergy(engine *xorm.Engine, masterId string, ch *rabbi Uid: v.Uid, Id: v.Id, }, md.OneCirclesRoutKeyForSignIn) + ids = append(ids, v.Id) + } + //6、更新 `one_circles_green_energy_sign_in` 中的 is_completed 状态 + if len(ids) > 0 { + _, err = engine.In("id", ids).Update(&model.OneCirclesGreenEnergySignIn{ + IsCompleted: 1, + }) } page++ time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000))) @@ -176,10 +184,6 @@ func HandleSettlementSignInGreenEnergy(engine *xorm.Engine, masterId string, id } } - //6、更新 `one_circles_green_energy_sign_in` 中的 is_completed 状态 - _, err = engine.Where("id = ?", id).Update(&model.OneCirclesGreenEnergySignIn{ - IsCompleted: 1, - }) if err != nil { _ = session.Rollback() fmt.Println("err:::::1111", err)