From 0199930e56f71b452b934607fcc36dda8c0bd958 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Thu, 1 Dec 2022 10:47:37 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=B8=AD=E5=9F=BA=E7=A7=AF=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rule/integral_release_settlement.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/rule/integral_release_settlement.go b/rule/integral_release_settlement.go index 6c16f0c..cde4cff 100644 --- a/rule/integral_release_settlement.go +++ b/rule/integral_release_settlement.go @@ -175,16 +175,6 @@ func DailySettlementIntegralReleaseForInterposition(engine *xorm.Engine, mid str return errors.New("非运行时间") } - if isTask { - //TODO::增加“悲观锁”防止串行 - getString, _ := cache.GetString(PessimismLockKeyForIntegralReleaseForInterposition) - if getString == PessimismLockValueForIntegralRelease { - fmt.Println("-----------------", "上一次结算未执行完") - return errors.New("上一次结算未执行完") - } - cache.SetEx(PessimismLockKeyForIntegralReleaseForInterposition, PessimismLockValueForIntegralRelease, 3600*10) //10小时 - } - //1、查找 `integral_release` 基础设置 integralRelease, err := db.IntegralReleaseGetOneByParams(session, map[string]interface{}{ "key": "is_use", @@ -199,6 +189,16 @@ func DailySettlementIntegralReleaseForInterposition(engine *xorm.Engine, mid str return errors.New("今日“积分释放”未结算") } + if isTask { + //TODO::增加“悲观锁”防止串行 + getString, _ := cache.GetString(PessimismLockKeyForIntegralReleaseForInterposition) + if getString == PessimismLockValueForIntegralRelease { + fmt.Println("-----------------", "上一次结算未执行完") + return errors.New("上一次结算未执行完") + } + cache.SetEx(PessimismLockKeyForIntegralReleaseForInterposition, PessimismLockValueForIntegralRelease, 3600*10) //10小时 + } + //2、查询所有 `integral_release_interposition_user_amount` 记录 var users []model.IntegralReleaseInterpositionUserAmount err = session.Where("waite_amount > 0").Find(&users)