Browse Source

update 一个圈圈

master
DengBiao 11 months ago
parent
commit
1ade9a13bc
1 changed files with 28 additions and 28 deletions
  1. +28
    -28
      rule/one_circles/one_circles_auto_release_green_energy.go

+ 28
- 28
rule/one_circles/one_circles_auto_release_green_energy.go View File

@@ -39,41 +39,41 @@ func AutoReleaseExchangeGreenEnergy(engine *xorm.Engine, masterId string) (err e
}

session := engine.NewSession()

//4、处理释放
settlementQuantityRadio := decimal.NewFromFloat(100)
settlementQuantityValue := decimal.NewFromInt(int64(settlementQuantity)).Div(settlementQuantityRadio)
for _, v := range list1 {
userAmount, _ := decimal.NewFromString(v.Amount)
settlementQuantityAmount, _ := userAmount.Mul(settlementQuantityValue).Float64()
if settlementQuantityAmount > 0 {
//4.2给相应的用户加上个人的绿色积分(可用数量)
err = DealUserCoin(session, md.DealUserCoinReq{
Kind: "add",
Mid: masterId,
Title: md.OneCirclesSettlementGreenEnergyExchangeGreenEnergy,
TransferType: md.OneCirclesSettlementGreenEnergyExchangeGreenEnergyForUserVirtualCoinFlow,
OrdId: "",
CoinId: oneCirclesGreenEnergyBasicSetting.PersonGreenEnergyCoinId,
Uid: v.Uid,
Amount: settlementQuantityAmount,
})

//4.2给相应的用户加上个人的绿色积分(可用数量)
err = DealUserCoin(session, md.DealUserCoinReq{
Kind: "add",
Mid: masterId,
Title: md.OneCirclesSettlementGreenEnergyExchangeGreenEnergy,
TransferType: md.OneCirclesSettlementGreenEnergyExchangeGreenEnergyForUserVirtualCoinFlow,
OrdId: "",
CoinId: oneCirclesGreenEnergyBasicSetting.PersonGreenEnergyCoinId,
Uid: v.Uid,
Amount: settlementQuantityAmount,
})

//4.2给相应的用户减少个人的绿色积分(结算数量)
err = DealUserCoin(session, md.DealUserCoinReq{
Kind: "sub",
Mid: masterId,
Title: md.OneCirclesSettlementGreenEnergyExchangeTobeGreenEnergy,
TransferType: md.OneCirclesSettlementGreenEnergyExchangeTobeGreenEnergyForUserVirtualCoinFlow,
OrdId: "",
CoinId: oneCirclesGreenEnergyBasicSetting.TeamGreenEnergyCoinId,
Uid: v.Uid,
Amount: settlementQuantityAmount,
})
if err != nil {
_ = session.Rollback()
fmt.Println("err:::::33333", err)
return err
//4.2给相应的用户减少个人的绿色积分(结算数量)
err = DealUserCoin(session, md.DealUserCoinReq{
Kind: "sub",
Mid: masterId,
Title: md.OneCirclesSettlementGreenEnergyExchangeTobeGreenEnergy,
TransferType: md.OneCirclesSettlementGreenEnergyExchangeTobeGreenEnergyForUserVirtualCoinFlow,
OrdId: "",
CoinId: oneCirclesGreenEnergyBasicSetting.TeamGreenEnergyCoinId,
Uid: v.Uid,
Amount: settlementQuantityAmount,
})
if err != nil {
_ = session.Rollback()
fmt.Println("err:::::33333", err)
return err
}
}
}



Loading…
Cancel
Save