From 57fa64e2288f6e977e741cf4dbbe6176b64e435b Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Sat, 1 Jun 2024 14:31:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rule/consume_integral_settlement.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/rule/consume_integral_settlement.go b/rule/consume_integral_settlement.go index 078bd08..f0843f7 100644 --- a/rule/consume_integral_settlement.go +++ b/rule/consume_integral_settlement.go @@ -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)