Browse Source

update

tags/v4.0.1
DengBiao 1 year ago
parent
commit
114e15acfb
1 changed files with 8 additions and 6 deletions
  1. +8
    -6
      rule/integral_release_settlement.go

+ 8
- 6
rule/integral_release_settlement.go View File

@@ -137,13 +137,15 @@ func DailySettlementIntegralReleaseForInterposition(engine *xorm.Engine, mid str
return errors.New("非运行时间") 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` 基础设置 //1、查找 `integral_release` 基础设置
integralRelease, err := db.IntegralReleaseGetOneByParams(session, map[string]interface{}{ integralRelease, err := db.IntegralReleaseGetOneByParams(session, map[string]interface{}{


Loading…
Cancel
Save