|
|
@@ -465,11 +465,7 @@ func ExchangeEnergy(c *gin.Context) { |
|
|
|
e.OutErr(c, e.ERR_UNMARSHAL, err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
amount, ok := energyAmount.Div(nowPrice).Float64() |
|
|
|
if !ok { |
|
|
|
e.OutErr(c, e.ERR_UNMARSHAL, nil) |
|
|
|
return |
|
|
|
} |
|
|
|
amount, _ := energyAmount.Div(nowPrice).Float64() |
|
|
|
|
|
|
|
// 3. 获取用户蛋蛋能量余额 |
|
|
|
eggEnergyAmount, err := rule.GetUserCoinAmount(session, coinID, user.Id) |
|
|
@@ -481,6 +477,7 @@ func ExchangeEnergy(c *gin.Context) { |
|
|
|
// 4. 判断蛋蛋能量是否足够兑换 |
|
|
|
if utils.StrToFloat64(eggEnergyAmount) < utils.StrToFloat64(req.EnergyAmount) { |
|
|
|
e.OutErr(c, e.ERR_BALANCE_NOT_ENOUGH, nil) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// 5. 调用降价公式 |
|
|
|