|
@@ -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)) //降价后的价格 |
|
|
|
|
|
|
|
|