Browse Source

Merge remote-tracking branch 'origin/master'

master
huangjiajun 5 months ago
parent
commit
e995b0d1a9
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      rule/one_circles/one_circles_available_green_energy_settlement.go

+ 7
- 1
rule/one_circles/one_circles_available_green_energy_settlement.go View File

@@ -122,9 +122,15 @@ func CalcPriceReductionFormula(engine *xorm.Engine, userExchangeNumsValue string
} }
priceHigherThanValue, _ := decimal.NewFromString(priceSettingStruct.PriceHigherThanValue) priceHigherThanValue, _ := decimal.NewFromString(priceSettingStruct.PriceHigherThanValue)
if nowPrice.Cmp(priceHigherThanValue) == 1 { if nowPrice.Cmp(priceHigherThanValue) == 1 {
err = errors.New("当前价格异常,请稍后重新兑换")
err = errors.New("当前价格异常过高,请稍后重新兑换")
return return
} }
priceBelowValue, _ := decimal.NewFromString(priceSettingStruct.PriceBelowValue)
if nowPrice.Cmp(priceBelowValue) == -1 {
err = errors.New("当前价格异常过低,请稍后重新兑换")
return
}

originalQuantityFunds, _ := decimal.NewFromString(oneCirclesGreenEnergyBasicSetting.OriginalFunds) //原始资金 originalQuantityFunds, _ := decimal.NewFromString(oneCirclesGreenEnergyBasicSetting.OriginalFunds) //原始资金
afterPrice := originalQuantityFunds.Div(userExchangeNums.Add(originalQuantityNums)) //降价后的价格 afterPrice := originalQuantityFunds.Div(userExchangeNums.Add(originalQuantityNums)) //降价后的价格




Loading…
Cancel
Save