From 5e65ebe50798bb8075f617c89ede9cc4f6f56f98 Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Mon, 9 Dec 2024 15:18:18 +0800 Subject: [PATCH] update exchange energy --- app/hdl/hdl_points_center.go | 2 +- app/svc/svc_home_page.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/hdl/hdl_points_center.go b/app/hdl/hdl_points_center.go index 43ac32e..d59a56f 100644 --- a/app/hdl/hdl_points_center.go +++ b/app/hdl/hdl_points_center.go @@ -465,7 +465,7 @@ func ExchangeEnergy(c *gin.Context) { e.OutErr(c, e.ERR_UNMARSHAL, err.Error()) return } - amount, _ := energyAmount.Div(nowPrice).Float64() + amount, _ := energyAmount.Mul(nowPrice).Float64() // 3. 获取用户蛋蛋能量余额 eggEnergyAmount, err := rule.GetUserCoinAmount(session, coinID, user.Id) diff --git a/app/svc/svc_home_page.go b/app/svc/svc_home_page.go index 8941652..ec8b1f0 100644 --- a/app/svc/svc_home_page.go +++ b/app/svc/svc_home_page.go @@ -22,6 +22,7 @@ func CalcTodayEggEnergyPriceRises(engine *xorm.Engine, now time.Time) (err error return err, 0, false, "", "" } initialPrice = m.Price + // todo 有数据后不需要此判断 if initialPrice == "" { initialPrice = "1" }