From f17858f5c7f8eb4cc1563ee0e05feda52fb9003e Mon Sep 17 00:00:00 2001 From: dengbiao Date: Sat, 14 Dec 2024 14:57:06 +0800 Subject: [PATCH 1/3] update --- app/hdl/hdl_points_center.go | 4 ++-- go.mod | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/hdl/hdl_points_center.go b/app/hdl/hdl_points_center.go index 37e0e5b..fb35192 100644 --- a/app/hdl/hdl_points_center.go +++ b/app/hdl/hdl_points_center.go @@ -481,7 +481,7 @@ func ExchangeEnergy(c *gin.Context) { } // 5. 调用降价公式 - err, calcPriceReductionFormula := egg_energy.CalcPriceReductionFormula(req.EnergyAmount, eggEnergyCoreData) + err, calcPriceReductionFormula := egg_energy.CalcPriceReductionFormula(req.EnergyAmount, eggEnergyCoreData, utils.IntToStr(user.Level), *setting) if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return @@ -490,7 +490,7 @@ func ExchangeEnergy(c *gin.Context) { // 6. 更改动态数据 err = egg_energy.DealAvailableEggEnergyCoin(session, int(enum.EggEnergyExchangeAccountBalance), eggEnergyCoreData, md3.DealAvailableEggEnergyCoinReq{ Amount: calcPriceReductionFormula.GetEggEnergyAmount, - AmountFee: "", + AmountFee: calcPriceReductionFormula.AmountFee, BeforePrice: calcPriceReductionFormula.BeforePrice, AfterPrice: calcPriceReductionFormula.AfterPrice, BeforePlanetTotalValue: calcPriceReductionFormula.BeforePlanetTotalValue, diff --git a/go.mod b/go.mod index 86be07d..c4a8c91 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/go-playground/universal-translator v0.18.1 github.com/go-playground/validator/v10 v10.20.0 github.com/go-redis/redis v6.15.9+incompatible - github.com/gomodule/redigo v2.0.0+incompatible + github.com/gomodule/redigo v1.9.2 github.com/jinzhu/copier v0.4.0 github.com/makiuchi-d/gozxing v0.0.0-20210324052758-57132e828831 github.com/qiniu/api.v7/v7 v7.8.2 @@ -32,12 +32,11 @@ require ( ) require ( - code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241213145511-1db189660e43 - code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241213103509-834ad0148103 + code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241214062221-cde2ce240fa8 + code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241214064241-afe361162281 code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible - github.com/gin-contrib/sessions v1.0.1 github.com/go-pay/crypto v0.0.1 github.com/go-pay/gopay v1.5.101 github.com/go-pay/xlog v0.0.2 From c69924220f891854c90d5b84aed801f4c5582cdb Mon Sep 17 00:00:00 2001 From: dengbiao Date: Sat, 14 Dec 2024 15:11:37 +0800 Subject: [PATCH 2/3] update --- app/hdl/hdl_points_center.go | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) 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 { From 78ca3ca4b6ab20183237eb73c209bf629b6edf1a Mon Sep 17 00:00:00 2001 From: dengbiao Date: Sat, 14 Dec 2024 15:58:51 +0800 Subject: [PATCH 3/3] update --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index c4a8c91..3eac54f 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( require ( code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241214062221-cde2ce240fa8 - code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241214064241-afe361162281 + code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241214075617-9e3855ecf0c0 code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible