|
@@ -245,18 +245,18 @@ 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) |
|
|
todays := zhios_order_relate_utils.GetTimeRange("today") |
|
|
todays := zhios_order_relate_utils.GetTimeRange("today") |
|
|
allMoney, _ := session.Where("is_send=? and create_time<?", 0, time.Unix(todays["start"], 0).Format("2006-01-02 15:04:05")).Sum(&models.SubsidyStoreMoney{}, "amount") |
|
|
|
|
|
|
|
|
allMoney, _ := session.Where("is_send=? and create_at<?", 0, time.Unix(todays["start"], 0).Format("2006-01-02 15:04:05")).Sum(&models.SubsidyStoreMoney{}, "amount") |
|
|
var eachAmount float64 = 0 |
|
|
var eachAmount float64 = 0 |
|
|
if hasStoreTotal > 0 { |
|
|
if hasStoreTotal > 0 { |
|
|
eachAmount = allMoney / float64(hasStoreTotal) |
|
|
eachAmount = allMoney / float64(hasStoreTotal) |
|
|
session.Where("is_send=? and create_time<?", 0, time.Unix(todays["start"], 0).Format("2006-01-02 15:04:05")).Cols("is_send").Update(&models.SubsidyStoreMoney{IsSend: 1}) |
|
|
|
|
|
|
|
|
session.Where("is_send=? and create_at<?", 0, time.Unix(todays["start"], 0).Format("2006-01-02 15:04:05")).Cols("is_send").Update(&models.SubsidyStoreMoney{IsSend: 1}) |
|
|
} |
|
|
} |
|
|
if hasStoreTotal > 0 && eachAmount > 0 { |
|
|
if hasStoreTotal > 0 && eachAmount > 0 { |
|
|
for _, v := range subsidyWithUserForStoreList { |
|
|
for _, v := range subsidyWithUserForStoreList { |
|
|
num := zhios_order_relate_utils.StrToFloat64(v.IntegralNum) / zhios_order_relate_utils.StrToFloat64(subsidyBase.ConsumptionIntegral) |
|
|
num := zhios_order_relate_utils.StrToFloat64(v.IntegralNum) / zhios_order_relate_utils.StrToFloat64(subsidyBase.ConsumptionIntegral) |
|
|
storeValue := zhios_order_relate_utils.FloatFormat(eachAmount*num, 2) |
|
|
storeValue := zhios_order_relate_utils.FloatFormat(eachAmount*num, 2) |
|
|
var err1 error |
|
|
var err1 error |
|
|
if storeStatusList[v.Uid]["status"] == "1" { |
|
|
|
|
|
|
|
|
if storeStatusList[v.Uid] != nil && storeStatusList[v.Uid]["status"] == "1" { |
|
|
storeTotalCountMap[v.Uid] += int(num) |
|
|
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)) |
|
|