Browse Source

update 中基积分

tags/v4.2.0
DengBiao 1 year ago
parent
commit
e5c8cf7781
1 changed files with 9 additions and 8 deletions
  1. +9
    -8
      rule/integral_release_settlement.go

+ 9
- 8
rule/integral_release_settlement.go View File

@@ -63,14 +63,15 @@ func DailySettlementIntegralRelease(engine *xorm.Engine, mid string, isTask bool
_ = session.Rollback() _ = session.Rollback()
return errors.New("今日“积分释放”已结算") return errors.New("今日“积分释放”已结算")
} }

//TODO::增加“悲观锁”防止串行
getString, _ := cache.GetString(PessimismLockKeyForIntegralRelease)
if getString == PessimismLockValueForIntegralRelease {
fmt.Println("-----------------", "上一次结算未执行完")
return errors.New("上一次结算未执行完")
if isTask {
//TODO::增加“悲观锁”防止串行
getString, _ := cache.GetString(PessimismLockKeyForIntegralRelease)
if getString == PessimismLockValueForIntegralRelease {
fmt.Println("-----------------", "上一次结算未执行完")
return errors.New("上一次结算未执行完")
}
cache.SetEx(PessimismLockKeyForIntegralRelease, PessimismLockValueForIntegralRelease, 3600*8) //8小时
} }
cache.SetEx(PessimismLockKeyForIntegralRelease, PessimismLockValueForIntegralRelease, 3600*8) //8小时


//TODO::关闭系统 //TODO::关闭系统
zhios_order_relate_utils.CurlPost("http://zhios-app:5000/api/v1/check_app_over_time", map[string]string{ zhios_order_relate_utils.CurlPost("http://zhios-app:5000/api/v1/check_app_over_time", map[string]string{
@@ -201,7 +202,7 @@ func DailySettlementIntegralReleaseForInterposition(engine *xorm.Engine, mid str
//2、查询所有 `integral_release_interposition_user_amount` 记录 //2、查询所有 `integral_release_interposition_user_amount` 记录
var users []model.IntegralReleaseInterpositionUserAmount var users []model.IntegralReleaseInterpositionUserAmount
err = session.Where("waite_amount > 0").Find(&users) err = session.Where("waite_amount > 0").Find(&users)
if integralRelease.ReleaseDate != today {
if err != nil {
_ = session.Rollback() _ = session.Rollback()
return err return err
} }


Loading…
Cancel
Save