diff --git a/rule/integral_release_settlement.go b/rule/integral_release_settlement.go index 6ce482a..b1e0e0a 100644 --- a/rule/integral_release_settlement.go +++ b/rule/integral_release_settlement.go @@ -137,13 +137,15 @@ func DailySettlementIntegralReleaseForInterposition(engine *xorm.Engine, mid str return errors.New("非运行时间") } - //TODO::增加“悲观锁”防止串行 - getString, _ := cache.GetString(PessimismLockKeyForIntegralReleaseForInterposition) - if getString == PessimismLockValueForIntegralRelease { - fmt.Println("-----------------", "上一次结算未执行完") - 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小时 } - cache.SetEx(PessimismLockKeyForIntegralReleaseForInterposition, PessimismLockValueForIntegralRelease, 3600*10) //10小时 //1、查找 `integral_release` 基础设置 integralRelease, err := db.IntegralReleaseGetOneByParams(session, map[string]interface{}{