瀏覽代碼

update

master
dengbiao 1 周之前
父節點
當前提交
d253a63d8a
共有 3 個檔案被更改,包括 44 行新增38 行删除
  1. +14
    -12
      rule/egg_energy/activity_coin_auto_exchange_egg_energy.go
  2. +5
    -5
      rule/egg_energy/available_green_energy_settlement.go
  3. +25
    -21
      rule/egg_energy/give_activty_coin.go

+ 14
- 12
rule/egg_energy/activity_coin_auto_exchange_egg_energy.go 查看文件

@@ -70,18 +70,20 @@ func ActivityCoinAutoExchangeEggPersonEnergy(engine *xorm.Engine, req md.EggEner
_ = session.Rollback()
return
}
err = rule.DealUserVirtualCoin(session, md2.DealUserVirtualCoinReq{
Kind: "add",
Title: enum.PersonEggGetByEnergyEggPointCoin.String(),
TransferType: int(enum.PersonEggGetByEnergyEggPointCoin),
CoinId: req.PersonEggEnergyCoinId,
Uid: req.Uid,
Amount: amountForTeam,
})
if err != nil {
fmt.Println("ActivityCoinAutoExchangeEggEnergy:::::err222:::", err)
_ = session.Rollback()
return
if amountForTeam > 0 {
err = rule.DealUserVirtualCoin(session, md2.DealUserVirtualCoinReq{
Kind: "add",
Title: enum.TeamEggGetByEnergyEggPointCoin.String(),
TransferType: int(enum.TeamEggGetByEnergyEggPointCoin),
CoinId: req.TeamEggEnergyCoinId,
Uid: req.Uid,
Amount: amountForTeam,
})
if err != nil {
fmt.Println("ActivityCoinAutoExchangeEggEnergy:::::err222:::", err)
_ = session.Rollback()
return
}
}

//3、修改sign记录


+ 5
- 5
rule/egg_energy/available_green_energy_settlement.go 查看文件

@@ -53,12 +53,12 @@ func CalcPriceReductionFormula(userExchangeNumsValue string, eggEnergyCoreData *
if v.VipLevelId == levelId {
exchangeAccountBalanceFeeValue = v.ExchangeAccountBalanceFee
}
if exchangeAccountBalanceFeeValue == "" {
err = errors.New("未查询到当前会员等级兑换余额手续费")
return
}
exchangeAccountBalanceFee, _ = decimal.NewFromString(exchangeAccountBalanceFeeValue) //兑换手续费
}
if exchangeAccountBalanceFeeValue == "" {
err = errors.New("未查询到当前会员等级兑换余额手续费")
return
}
exchangeAccountBalanceFee, _ = decimal.NewFromString(exchangeAccountBalanceFeeValue) //兑换手续费
}

decimalRate := decimal.NewFromInt(100) //百分比


+ 25
- 21
rule/egg_energy/give_activty_coin.go 查看文件

@@ -237,31 +237,35 @@ func SettlementGiveActivityCoin(engine *xorm.Engine, user model.User, ecpm strin
}

//给相应的用户上级加上"团队"活跃积分
err = rule.DealUserVirtualCoin(session, md.DealUserVirtualCoinReq{
Kind: "add",
Title: enum.UserVirtualAmountFlowTransferType.String(enum.EggEnergyWatchAdRewardFansActiveCoin),
TransferType: int(enum.EggEnergyWatchAdRewardFansActiveCoin),
CoinId: eggEnergyBasicSetting.TeamEggPointsCoinId,
Uid: user.ParentUid,
Amount: fatherRewardValue,
})
if err != nil {
_ = session.Rollback()
fmt.Println("err:::::2222", err)
return rewardValue, err
if fatherRewardValue > 0 {
err = rule.DealUserVirtualCoin(session, md.DealUserVirtualCoinReq{
Kind: "add",
Title: enum.UserVirtualAmountFlowTransferType.String(enum.EggEnergyWatchAdRewardFansActiveCoin),
TransferType: int(enum.EggEnergyWatchAdRewardFansActiveCoin),
CoinId: eggEnergyBasicSetting.TeamEggPointsCoinId,
Uid: user.ParentUid,
Amount: fatherRewardValue,
})
if err != nil {
_ = session.Rollback()
fmt.Println("err:::::2222", err)
return rewardValue, err
}
}

//给相应的用户加上"团队"活跃积分
for _, vv := range rewardFather {
//TODO::推入rabbitmq 异步处理
ch.Publish(md2.EggEnergyExchange, md.DealUserVirtualCoinReq{
Kind: "add",
Title: enum.UserVirtualAmountFlowTransferType.String(enum.EggEnergyWatchAdRewardTeamActiveCoin),
TransferType: int(enum.EggEnergyWatchAdRewardTeamActiveCoin),
CoinId: eggEnergyBasicSetting.TeamEggPointsCoinId,
Uid: vv.Uid,
Amount: vv.RewardValue,
}, md2.EggEnergyRoutKeyForSettlementPublicGiveActivityCoin)
if vv.RewardValue > 0 {
//TODO::推入rabbitmq 异步处理
ch.Publish(md2.EggEnergyExchange, md.DealUserVirtualCoinReq{
Kind: "add",
Title: enum.UserVirtualAmountFlowTransferType.String(enum.EggEnergyWatchAdRewardTeamActiveCoin),
TransferType: int(enum.EggEnergyWatchAdRewardTeamActiveCoin),
CoinId: eggEnergyBasicSetting.TeamEggPointsCoinId,
Uid: vv.Uid,
Amount: vv.RewardValue,
}, md2.EggEnergyRoutKeyForSettlementPublicGiveActivityCoin)
}
}
err = session.Commit()
if err != nil {


Loading…
取消
儲存