Browse Source

更新

master
huangjiajun 1 year ago
parent
commit
3d118caadf
2 changed files with 11 additions and 4 deletions
  1. +1
    -0
      db/model/subsidy_base.go
  2. +10
    -4
      rule/consume_integral_settlement.go

+ 1
- 0
db/model/subsidy_base.go View File

@@ -5,6 +5,7 @@ type SubsidyBase struct {
IsOpen int `json:"is_open" xorm:"default 0 comment('功能开关:') INT(1)"`
LvId string `json:"lv_id" xorm:"comment('json [] 兑换等级:') VARCHAR(255)"`
FloatSubsidyOpen int `json:"float_subsidy_open" xorm:"default 0 comment('浮动补贴比例:') INT(1)"`
FloatSubsidyBili int `json:"float_subsidy_bili" xorm:"default 0 comment('浮动补贴比例:') INT(11)"`
BaseSubsidyMoney string `json:"base_subsidy_money" xorm:"default 0.00 comment('补贴基础金额设置:') DECIMAL(20,2)"`
ConsumptionIntegral string `json:"consumption_integral" xorm:"not null default 0.00 comment('消费积分数量') DECIMAL(20,2)"`
ConsumptionMoney string `json:"consumption_money" xorm:"default 0.00 comment('消费补贴') DECIMAL(20,2)"`


+ 10
- 4
rule/consume_integral_settlement.go View File

@@ -163,9 +163,12 @@ func DailySettlementBlockConsumeIntegral(engine *xorm.Engine, mid string, isTask
func calcNowEverydayConsumeIntegral(subsidyBase *model.SubsidyBase, hasConsumeTotal int64) (value float64, err error) {
consumptionMoney, _ := decimal.NewFromString(subsidyBase.ConsumptionTotalMoney)
baseSubsidyMoney, _ := decimal.NewFromString(subsidyBase.BaseSubsidyMoney)
floatSubsidyOpen := decimal.NewFromInt(int64(subsidyBase.FloatSubsidyOpen) / 10000)
if subsidyBase.FloatSubsidyOpen == 0 { //没有浮动补贴情况
subsidyBase.FloatSubsidyBili = 0
}
floatSubsidyBili := decimal.NewFromInt(int64(subsidyBase.FloatSubsidyBili) / 10000)
consumeTotal := decimal.NewFromInt(hasConsumeTotal)
value, _ = consumptionMoney.Mul(floatSubsidyOpen).Div(consumeTotal).Add(baseSubsidyMoney).Float64()
value, _ = consumptionMoney.Mul(floatSubsidyBili).Div(consumeTotal).Add(baseSubsidyMoney).Float64()
return
}

@@ -174,9 +177,12 @@ func calcNowEverydayExperienceIntegral(subsidyBase *model.SubsidyBase, hasExperi
//2、通过公式计算 "((资金池的金额 * 浮动比例) / 体验补贴总数) + 基础补贴"
experienceMoney, _ := decimal.NewFromString(subsidyBase.ExperienceTotalMoney)
baseSubsidyMoney, _ := decimal.NewFromString(subsidyBase.BaseSubsidyMoney)
floatSubsidyOpen := decimal.NewFromInt(int64(subsidyBase.FloatSubsidyOpen) / 10000)
if subsidyBase.FloatSubsidyOpen == 0 { //没有浮动补贴情况
subsidyBase.FloatSubsidyBili = 0
}
floatSubsidyBili := decimal.NewFromInt(int64(subsidyBase.FloatSubsidyBili) / 10000)
consumeTotal := decimal.NewFromInt(hasExperienceTotal)
value, _ = experienceMoney.Mul(floatSubsidyOpen).Div(consumeTotal).Add(baseSubsidyMoney).Float64()
value, _ = experienceMoney.Mul(floatSubsidyBili).Div(consumeTotal).Add(baseSubsidyMoney).Float64()
return
}



Loading…
Cancel
Save