Browse Source

更新

master
huangjiajun 5 months ago
parent
commit
57fa64e228
1 changed files with 5 additions and 7 deletions
  1. +5
    -7
      rule/consume_integral_settlement.go

+ 5
- 7
rule/consume_integral_settlement.go View File

@@ -85,7 +85,7 @@ func DailySettlementBlockConsumeIntegral(engine *xorm.Engine, mid string, isTask
cache.SetEx(key, PessimismLockValueForConsumeIntegral, 3600*8) //8小时

var consumeValueTotal, experienceValueTotal, storeValueTotal = decimal.NewFromInt(0), decimal.NewFromInt(0), decimal.NewFromInt(0)
var consumeValue, experienceValue, storeValue float64
var consumeValue, experienceValue float64
//1、统计当前拥有多少份消费补贴
startAt := time.Now().Add(time.Duration(subsidyBase.ConsumptionDay) * -24 * time.Hour).Format("2006-01-02") //起始时间
var subsidyWithUserForConsumeList []model.SubsidyWithUser
@@ -185,13 +185,11 @@ func DailySettlementBlockConsumeIntegral(engine *xorm.Engine, mid string, isTask
if subsidyBase.StoreOpen == 1 {
var storeTotalCountMap = make(map[int]int)
if hasStoreTotal > 0 && consumeValue > 0 {
storeValue, err = calcNowEverydayStoreIntegral(consumeValue, zhios_order_relate_utils.StrToFloat64(subsidyBase.StoreIntegral)/zhios_order_relate_utils.StrToFloat64(subsidyBase.ConsumptionIntegral))
if err != nil {
_ = session.Rollback()
return err, totalMap, storeTotalMap
}

for _, v := range subsidyWithUserForStoreList {
storeTotalCountMap[v.Uid]++
num := zhios_order_relate_utils.StrToFloat64(v.IntegralNum) / zhios_order_relate_utils.StrToFloat64(subsidyBase.ConsumptionIntegral)
storeValue := zhios_order_relate_utils.FloatFormat(consumeValue*num, 2)
storeTotalCountMap[v.Uid] += int(num)
storeTotalMap[v.Uid] = storeTotalMap[v.Uid].Add(decimal.NewFromFloat(storeValue))
storeValueTotal = storeValueTotal.Add(decimal.NewFromFloat(storeValue))
err1 := DealUserStoreIntegral(session, &v, storeValue, mid)


Loading…
Cancel
Save