Browse Source

update

master
dengbiao 5 days ago
parent
commit
d895a4983b
1 changed files with 36 additions and 31 deletions
  1. +36
    -31
      rule/egg_energy/activity_coin_start_exchange_egg_person_energy.go

+ 36
- 31
rule/egg_energy/activity_coin_start_exchange_egg_person_energy.go View File

@@ -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记录


Loading…
Cancel
Save