diff --git a/app/hdl/hdl_points_center.go b/app/hdl/hdl_points_center.go index fb35192..c1fb554 100644 --- a/app/hdl/hdl_points_center.go +++ b/app/hdl/hdl_points_center.go @@ -455,17 +455,6 @@ func ExchangeEnergy(c *gin.Context) { if cb != nil { defer cb() // 释放锁 } - energyAmount, err := decimal.NewFromString(req.EnergyAmount) - if err != nil { - e.OutErr(c, e.ERR_UNMARSHAL, err.Error()) - return - } - nowPrice, err := decimal.NewFromString(eggEnergyCoreData.NowPrice) - if err != nil { - e.OutErr(c, e.ERR_UNMARSHAL, err.Error()) - return - } - amount, _ := energyAmount.Mul(nowPrice).Float64() // 3. 获取用户蛋蛋能量余额 eggEnergyAmount, err := rule.GetUserCoinAmount(session, coinID, user.Id) @@ -489,7 +478,7 @@ func ExchangeEnergy(c *gin.Context) { // 6. 更改动态数据 err = egg_energy.DealAvailableEggEnergyCoin(session, int(enum.EggEnergyExchangeAccountBalance), eggEnergyCoreData, md3.DealAvailableEggEnergyCoinReq{ - Amount: calcPriceReductionFormula.GetEggEnergyAmount, + Amount: req.EnergyAmount, AmountFee: calcPriceReductionFormula.AmountFee, BeforePrice: calcPriceReductionFormula.BeforePrice, AfterPrice: calcPriceReductionFormula.AfterPrice, @@ -526,7 +515,7 @@ func ExchangeEnergy(c *gin.Context) { Kind: int(enum.EggEnergyExchangeAccountBalance), Title: enum.EggEnergyExchangeAccountBalance.String(), Uid: user.Id, - Amount: amount, + Amount: utils.StrToFloat64(calcPriceReductionFormula.GetEggEnergyAmount), } err = rule.DealUserWallet(session, dealUserWalletReq) if err != nil {