|
@@ -85,7 +85,7 @@ func DailySettlementBlockConsumeIntegral(engine *xorm.Engine, mid string, isTask |
|
|
cache.SetEx(key, PessimismLockValueForConsumeIntegral, 3600*8) //8小时 |
|
|
cache.SetEx(key, PessimismLockValueForConsumeIntegral, 3600*8) //8小时 |
|
|
|
|
|
|
|
|
var consumeValueTotal, experienceValueTotal, storeValueTotal = decimal.NewFromInt(0), decimal.NewFromInt(0), decimal.NewFromInt(0) |
|
|
var consumeValueTotal, experienceValueTotal, storeValueTotal = decimal.NewFromInt(0), decimal.NewFromInt(0), decimal.NewFromInt(0) |
|
|
var consumeValue, experienceValue, storeValue float64 |
|
|
|
|
|
|
|
|
var consumeValue, experienceValue float64 |
|
|
//1、统计当前拥有多少份消费补贴 |
|
|
//1、统计当前拥有多少份消费补贴 |
|
|
startAt := time.Now().Add(time.Duration(subsidyBase.ConsumptionDay) * -24 * time.Hour).Format("2006-01-02") //起始时间 |
|
|
startAt := time.Now().Add(time.Duration(subsidyBase.ConsumptionDay) * -24 * time.Hour).Format("2006-01-02") //起始时间 |
|
|
var subsidyWithUserForConsumeList []model.SubsidyWithUser |
|
|
var subsidyWithUserForConsumeList []model.SubsidyWithUser |
|
@@ -185,13 +185,11 @@ func DailySettlementBlockConsumeIntegral(engine *xorm.Engine, mid string, isTask |
|
|
if subsidyBase.StoreOpen == 1 { |
|
|
if subsidyBase.StoreOpen == 1 { |
|
|
var storeTotalCountMap = make(map[int]int) |
|
|
var storeTotalCountMap = make(map[int]int) |
|
|
if hasStoreTotal > 0 && consumeValue > 0 { |
|
|
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 { |
|
|
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)) |
|
|
storeTotalMap[v.Uid] = storeTotalMap[v.Uid].Add(decimal.NewFromFloat(storeValue)) |
|
|
storeValueTotal = storeValueTotal.Add(decimal.NewFromFloat(storeValue)) |
|
|
storeValueTotal = storeValueTotal.Add(decimal.NewFromFloat(storeValue)) |
|
|
err1 := DealUserStoreIntegral(session, &v, storeValue, mid) |
|
|
err1 := DealUserStoreIntegral(session, &v, storeValue, mid) |
|
|