浏览代码

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	go.mod
tmp
huangjiajun 3 周前
父节点
当前提交
3d6e97dc2c
共有 2 个文件被更改,包括 6 次插入17 次删除
  1. +4
    -15
      app/hdl/hdl_points_center.go
  2. +2
    -2
      go.mod

+ 4
- 15
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)
@@ -481,7 +470,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
@@ -489,8 +478,8 @@ func ExchangeEnergy(c *gin.Context) {

// 6. 更改动态数据
err = egg_energy.DealAvailableEggEnergyCoin(session, int(enum.EggEnergyExchangeAccountBalance), eggEnergyCoreData, md3.DealAvailableEggEnergyCoinReq{
Amount: calcPriceReductionFormula.GetEggEnergyAmount,
AmountFee: "",
Amount: req.EnergyAmount,
AmountFee: calcPriceReductionFormula.AmountFee,
BeforePrice: calcPriceReductionFormula.BeforePrice,
AfterPrice: calcPriceReductionFormula.AfterPrice,
BeforePlanetTotalValue: calcPriceReductionFormula.BeforePlanetTotalValue,
@@ -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 {


+ 2
- 2
go.mod 查看文件

@@ -32,8 +32,8 @@ require (
)

require (
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241214095356-fdac2df9537f
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241214095427-b3f9e6ed2446
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.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


正在加载...
取消
保存