diff --git a/rule/self_buy_global.go b/rule/self_buy_global.go index 529a256..dcbe477 100644 --- a/rule/self_buy_global.go +++ b/rule/self_buy_global.go @@ -222,6 +222,7 @@ func Pool(eg *xorm.Engine, price string) error { userSumMap[v["uid"]] -= leave } } + var RealBonusValue float64 = 0 for k, v := range userSumMap { if v <= 0 { continue @@ -231,7 +232,10 @@ func Pool(eg *xorm.Engine, price string) error { session.Rollback() return errors.New("失败") } + RealBonusValue += v } + bonus.RealBonusValue = zhios_order_relate_utils.Float64ToStrByPrec(RealBonusValue, 2) + bonus.LossBonusValue = zhios_order_relate_utils.Float64ToStrByPrec(zhios_order_relate_utils.StrToFloat64(price)-RealBonusValue, 2) bonus.BonusUserNum = zhios_order_relate_utils.IntToStr(sum) bonus.BonusUserRecord = zhios_order_relate_utils.SerializeStr(userSumMap) bonus.BonusPeriod = bonus.Id