|
|
@@ -49,18 +49,20 @@ func ActivityCoinStartExchangeEggEnergy(engine *xorm.Engine, req md.EggEnergyStr |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
err = rule.DealUserVirtualCoin(session, md2.DealUserVirtualCoinReq{ |
|
|
|
Kind: "sub", |
|
|
|
Title: enum.EggPointCoinToExchangeToTeamEggEnergy.String(), |
|
|
|
TransferType: int(enum.EggPointCoinToExchangeToTeamEggEnergy), |
|
|
|
CoinId: req.TeamEnergyCoinId, |
|
|
|
Uid: req.Uid, |
|
|
|
Amount: egg_system_rules.StrToFloat64(sign.TotalTeamEggPoints), |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
|
fmt.Println("ActivityCoinStartExchangeEggEnergy:::::er222:::", err) |
|
|
|
_ = session.Rollback() |
|
|
|
return |
|
|
|
if egg_system_rules.StrToFloat64(sign.TotalTeamEggPoints) > 0 { |
|
|
|
err = rule.DealUserVirtualCoin(session, md2.DealUserVirtualCoinReq{ |
|
|
|
Kind: "sub", |
|
|
|
Title: enum.EggPointCoinToExchangeToTeamEggEnergy.String(), |
|
|
|
TransferType: int(enum.EggPointCoinToExchangeToTeamEggEnergy), |
|
|
|
CoinId: req.TeamEnergyCoinId, |
|
|
|
Uid: req.Uid, |
|
|
|
Amount: egg_system_rules.StrToFloat64(sign.TotalTeamEggPoints), |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
|
fmt.Println("ActivityCoinStartExchangeEggEnergy:::::er222:::", err) |
|
|
|
_ = session.Rollback() |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//3、进行兑换购买 |
|
|
@@ -96,25 +98,28 @@ func ActivityCoinStartExchangeEggEnergy(engine *xorm.Engine, req md.EggEnergyStr |
|
|
|
} |
|
|
|
|
|
|
|
//3.2、"团队" 购买 |
|
|
|
err1, calcPriceIncreaseFormulaRespForTeam := CalcPriceIncreaseFormula(sign.TotalTeamEggPointsAmountValue, eggEnergyCoreData) |
|
|
|
if err1 != nil { |
|
|
|
_ = session.Rollback() |
|
|
|
return err1 |
|
|
|
} |
|
|
|
err = DealAvailableEggEnergyCoin(session, int(enum2.TeamActivePointRedemption), eggEnergyCoreData, md.DealAvailableEggEnergyCoinReq{ |
|
|
|
Amount: calcPriceIncreaseFormulaRespForTeam.GetEggEnergyNums, |
|
|
|
AmountFee: "", |
|
|
|
BeforePrice: calcPriceIncreaseFormulaRespForTeam.BeforePrice, |
|
|
|
AfterPrice: calcPriceIncreaseFormulaRespForTeam.AfterPrice, |
|
|
|
BeforePlanetTotalValue: calcPriceIncreaseFormulaRespForTeam.BeforePlanetTotalValue, |
|
|
|
AfterPlanetTotalValue: calcPriceIncreaseFormulaRespForTeam.AfterPlanetTotalValue, |
|
|
|
BeforeEnergyTotalNums: calcPriceIncreaseFormulaRespForTeam.BeforeEnergyTotalNums, |
|
|
|
AfterEnergyTotalNums: calcPriceIncreaseFormulaRespForTeam.AfterEnergyTotalNums, |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
|
fmt.Println("ActivityCoinStartExchangeEggEnergy:::::err444:::", err) |
|
|
|
_ = session.Rollback() |
|
|
|
return err |
|
|
|
var calcPriceIncreaseFormulaRespForTeam md.CalcPriceIncreaseFormulaResp |
|
|
|
if egg_system_rules.StrToFloat64(sign.TotalTeamEggPoints) > 0 { |
|
|
|
err1, calcPriceIncreaseFormulaRespForTeam = CalcPriceIncreaseFormula(sign.TotalTeamEggPointsAmountValue, eggEnergyCoreData) |
|
|
|
if err1 != nil { |
|
|
|
_ = session.Rollback() |
|
|
|
return err1 |
|
|
|
} |
|
|
|
err = DealAvailableEggEnergyCoin(session, int(enum2.TeamActivePointRedemption), eggEnergyCoreData, md.DealAvailableEggEnergyCoinReq{ |
|
|
|
Amount: calcPriceIncreaseFormulaRespForTeam.GetEggEnergyNums, |
|
|
|
AmountFee: "", |
|
|
|
BeforePrice: calcPriceIncreaseFormulaRespForTeam.BeforePrice, |
|
|
|
AfterPrice: calcPriceIncreaseFormulaRespForTeam.AfterPrice, |
|
|
|
BeforePlanetTotalValue: calcPriceIncreaseFormulaRespForTeam.BeforePlanetTotalValue, |
|
|
|
AfterPlanetTotalValue: calcPriceIncreaseFormulaRespForTeam.AfterPlanetTotalValue, |
|
|
|
BeforeEnergyTotalNums: calcPriceIncreaseFormulaRespForTeam.BeforeEnergyTotalNums, |
|
|
|
AfterEnergyTotalNums: calcPriceIncreaseFormulaRespForTeam.AfterEnergyTotalNums, |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
|
fmt.Println("ActivityCoinStartExchangeEggEnergy:::::err444:::", err) |
|
|
|
_ = session.Rollback() |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//4、修改sign记录 |
|
|
|