|
|
@@ -1,6 +1,7 @@ |
|
|
|
package egg_energy |
|
|
|
|
|
|
|
import ( |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" |
|
|
|
"code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/enum" |
|
|
|
md2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md" |
|
|
@@ -11,481 +12,266 @@ import ( |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
|
|
|
|
|
func DealAvailableGreenEnergyCoin(session *xorm.Session, kind int, amount, amountFee float64, title string, eggEnergyCoreData *model.EggEnergyCoreData, nowPriceValue string) error { |
|
|
|
if eggEnergyCoreData == nil { |
|
|
|
func DealAvailableEggEnergyCoin(session *xorm.Session, kind int, eggEnergyCoreData *model.EggEnergyCoreData, req md2.DealAvailableEggEnergyCoinReq) error { |
|
|
|
|
|
|
|
if eggEnergyCoreData == nil { //TODO::存在使用风险 |
|
|
|
// 查找 `egg_energy_core_data` 基础设置 |
|
|
|
oneCirclesGreenEnergyBasicSetting, cb, err := svc.GetEggEnergyCoreData(session.Engine()) |
|
|
|
nowPriceValue = oneCirclesGreenEnergyBasicSetting.NowPrice |
|
|
|
eggEnergyCoreDataModel, cb, err := svc.GetEggEnergyCoreData(session.Engine()) |
|
|
|
if err != nil { |
|
|
|
return err |
|
|
|
} |
|
|
|
if cb != nil { |
|
|
|
defer cb() // 释放锁 |
|
|
|
} |
|
|
|
chain = oneCirclesGreenEnergyBasicSetting |
|
|
|
eggEnergyCoreData = eggEnergyCoreDataModel |
|
|
|
} |
|
|
|
amountValue := decimal.NewFromFloat(amount) |
|
|
|
|
|
|
|
amountValue, _ := decimal.NewFromString(req.Amount) |
|
|
|
now := time.Now() |
|
|
|
var oneCirclesAvailableGreenEnergyPointsFlow model.OneCirclesAvailableGreenEnergyPointsFlow |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.CoinId = chain.PersonGreenEnergyCoinId |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.Kind = kind |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.Title = title |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.Amount = amountValue.RoundFloor(8).String() |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.CreateTime = now |
|
|
|
var eggEnergyAvailableEnergyFlow model.EggEnergyAvailableEnergyFlow |
|
|
|
eggEnergyAvailableEnergyFlow.Kind = kind |
|
|
|
eggEnergyAvailableEnergyFlow.Title = enum.EggEnergyAvailableEnergyFlowKind(kind).String() |
|
|
|
eggEnergyAvailableEnergyFlow.BeforePrice = req.BeforePrice |
|
|
|
eggEnergyAvailableEnergyFlow.AfterPrice = req.AfterPrice |
|
|
|
eggEnergyAvailableEnergyFlow.Amount = amountValue.RoundFloor(8).String() |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeNowEnergyTotalNums = req.BeforeEnergyTotalNums //现行总量 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterNowEnergyTotalNums = req.AfterEnergyTotalNums |
|
|
|
eggEnergyAvailableEnergyFlow.BeforePlanetTotalValue = req.BeforePlanetTotalValue //星球总价值 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterNowEnergyTotalNums = req.AfterPlanetTotalValue |
|
|
|
eggEnergyAvailableEnergyFlow.CreateTime = now.Format("2006-01-02 15:04:05") |
|
|
|
|
|
|
|
nowPrice, _ := decimal.NewFromString(nowPriceValue) |
|
|
|
switch kind { |
|
|
|
case int(enum.PersonalActivePointRedemption): //个人活跃积分兑换 |
|
|
|
beforeOriginalQuantity, _ := decimal.NewFromString(chain.OriginalQuantityNums) |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.Direction = 1 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeEcologicalApplicationValues = chain.EcologicalApplication //生态应用 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterEcologicalApplicationValues = chain.EcologicalApplication |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeTechnicalTeamValues = chain.TotalTechnologyTeam //技术团队 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterTechnicalTeamValues = chain.TotalTechnologyTeam |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOperateTeamValues = chain.TotalOperateTeam //运营团队 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOperateTeamValues = chain.TotalOperateTeam |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeActiveGiveawaysValues = chain.TotalActiveGiveaways //活跃赠送 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterActiveGiveawaysValues = chain.TotalActiveGiveaways |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOriginalQuantityValues = chain.OriginalQuantityNums //原始数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOriginalQuantityValues = beforeOriginalQuantity.Sub(amountValue).RoundFloor(8).String() |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeMarketplaceMerchantValues = chain.MarketplaceMerchantNums //市商数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterMarketplaceMerchantValues = chain.MarketplaceMerchantNums |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeDevelopmentCommitteeValues = chain.DevelopmentCommittee //发展委员会 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterDevelopmentCommitteeValues = chain.DevelopmentCommittee |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforePublicWelfareAndCharityValues = chain.PublicWelfareAndCharity //公益慈善 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterPublicWelfareAndCharityValues = chain.PublicWelfareAndCharity |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeStarLevelDividendsValues = chain.StarLevelDividends //星级分红 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterStarLevelDividendsValues = chain.StarLevelDividends |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeCommunityDividends = chain.CommunityDividends //社区分红 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterCommunityDividends = chain.CommunityDividends |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeDestructionQuantityValues = chain.DestructionQuantityNums //销毁数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterDestructionQuantityValues = chain.DestructionQuantityNums |
|
|
|
|
|
|
|
amountFeeValue := decimal.NewFromFloat(amountFee) //积分价值 |
|
|
|
originalFunds, _ := decimal.NewFromString(chain.OriginalFunds) //原始资金 |
|
|
|
afterOriginalFundValues := originalFunds.Add(amountFeeValue).RoundFloor(8).String() |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOriginalQuantityFundValues = chain.OriginalFunds //原始资金 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOriginalQuantityFundValues = afterOriginalFundValues |
|
|
|
|
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeMarketplaceMerchantFundValues = chain.MarketplaceMerchantFunds //市商资金 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterMarketplaceMerchantFundValues = chain.MarketplaceMerchantFunds |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeMarketplaceMerchantValues = eggEnergyCoreData.MarketplaceMerchantNums //市商数量 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterMarketplaceMerchantValues = eggEnergyCoreData.MarketplaceMerchantNums |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeMarketplaceMerchantFundValues = eggEnergyCoreData.MarketplaceMerchantFunds //市商资金 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterMarketplaceMerchantFundValues = eggEnergyCoreData.MarketplaceMerchantFunds |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeDevelopmentCommitteeValues = eggEnergyCoreData.DevelopmentCommittee //发展委员会 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterDevelopmentCommitteeValues = eggEnergyCoreData.DevelopmentCommittee |
|
|
|
eggEnergyAvailableEnergyFlow.BeforePublicWelfareAndCharityValues = eggEnergyCoreData.PublicWelfareAndCharity //公益慈善 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterPublicWelfareAndCharityValues = eggEnergyCoreData.PublicWelfareAndCharity |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeStarLevelDividendsValues = eggEnergyCoreData.StarLevelDividends //星级分红 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterStarLevelDividendsValues = eggEnergyCoreData.StarLevelDividends |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeCommunityDividends = eggEnergyCoreData.CommunityDividends //社区分红 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterCommunityDividends = eggEnergyCoreData.CommunityDividends |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeDestructionQuantityValues = eggEnergyCoreData.DestructionQuantityNums //销毁数量 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterDestructionQuantityValues = eggEnergyCoreData.DestructionQuantityNums |
|
|
|
break |
|
|
|
case int(enum.TeamActivePointRedemption): //团队活跃积分兑换 |
|
|
|
beforeOriginalQuantity, _ := decimal.NewFromString(chain.OriginalQuantityNums) |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.Direction = 1 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeEcologicalApplicationValues = chain.EcologicalApplication //生态应用 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterEcologicalApplicationValues = chain.EcologicalApplication |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeTechnicalTeamValues = chain.TotalTechnologyTeam //技术团队 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterTechnicalTeamValues = chain.TotalTechnologyTeam |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOperateTeamValues = chain.TotalOperateTeam //运营团队 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOperateTeamValues = chain.TotalOperateTeam |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeActiveGiveawaysValues = chain.TotalActiveGiveaways //活跃赠送 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterActiveGiveawaysValues = chain.TotalActiveGiveaways |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOriginalQuantityValues = chain.OriginalQuantityNums //原始数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOriginalQuantityValues = beforeOriginalQuantity.Sub(amountValue).RoundFloor(8).String() |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeMarketplaceMerchantValues = chain.MarketplaceMerchantNums //市商数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterMarketplaceMerchantValues = chain.MarketplaceMerchantNums |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeDevelopmentCommitteeValues = chain.DevelopmentCommittee //发展委员会 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterDevelopmentCommitteeValues = chain.DevelopmentCommittee |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforePublicWelfareAndCharityValues = chain.PublicWelfareAndCharity //公益慈善 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterPublicWelfareAndCharityValues = chain.PublicWelfareAndCharity |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeStarLevelDividendsValues = chain.StarLevelDividends //星级分红 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterStarLevelDividendsValues = chain.StarLevelDividends |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeCommunityDividends = chain.CommunityDividends //社区分红 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterCommunityDividends = chain.CommunityDividends |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeDestructionQuantityValues = chain.DestructionQuantityNums //销毁数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterDestructionQuantityValues = chain.DestructionQuantityNums |
|
|
|
|
|
|
|
amountFeeValue := decimal.NewFromFloat(amountFee) //积分价值 |
|
|
|
originalFunds, _ := decimal.NewFromString(chain.OriginalFunds) //原始资金 |
|
|
|
afterOriginalFundValues := originalFunds.Add(amountFeeValue).RoundFloor(8).String() |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOriginalQuantityFundValues = chain.OriginalFunds //原始资金 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOriginalQuantityFundValues = afterOriginalFundValues |
|
|
|
|
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeMarketplaceMerchantFundValues = chain.MarketplaceMerchantFunds //市商资金 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterMarketplaceMerchantFundValues = chain.MarketplaceMerchantFunds |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeMarketplaceMerchantValues = eggEnergyCoreData.MarketplaceMerchantNums //市商数量 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterMarketplaceMerchantValues = eggEnergyCoreData.MarketplaceMerchantNums |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeMarketplaceMerchantFundValues = eggEnergyCoreData.MarketplaceMerchantFunds //市商资金 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterMarketplaceMerchantFundValues = eggEnergyCoreData.MarketplaceMerchantFunds |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeDevelopmentCommitteeValues = eggEnergyCoreData.DevelopmentCommittee //发展委员会 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterDevelopmentCommitteeValues = eggEnergyCoreData.DevelopmentCommittee |
|
|
|
eggEnergyAvailableEnergyFlow.BeforePublicWelfareAndCharityValues = eggEnergyCoreData.PublicWelfareAndCharity //公益慈善 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterPublicWelfareAndCharityValues = eggEnergyCoreData.PublicWelfareAndCharity |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeStarLevelDividendsValues = eggEnergyCoreData.StarLevelDividends //星级分红 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterStarLevelDividendsValues = eggEnergyCoreData.StarLevelDividends |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeCommunityDividends = eggEnergyCoreData.CommunityDividends //社区分红 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterCommunityDividends = eggEnergyCoreData.CommunityDividends |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeDestructionQuantityValues = eggEnergyCoreData.DestructionQuantityNums //销毁数量 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterDestructionQuantityValues = eggEnergyCoreData.DestructionQuantityNums |
|
|
|
break |
|
|
|
case int(enum.SettlementOfGreenEnergyRelease): //结算绿色能量释放 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.Direction = 1 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeEcologicalApplicationValues = chain.EcologicalApplication //生态应用 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterEcologicalApplicationValues = chain.EcologicalApplication |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeTechnicalTeamValues = chain.TotalTechnologyTeam //技术团队 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterTechnicalTeamValues = chain.TotalTechnologyTeam |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOperateTeamValues = chain.TotalOperateTeam //运营团队 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOperateTeamValues = chain.TotalOperateTeam |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeActiveGiveawaysValues = chain.TotalActiveGiveaways //活跃赠送 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterActiveGiveawaysValues = chain.TotalActiveGiveaways |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOriginalQuantityValues = chain.OriginalQuantityNums //原始数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOriginalQuantityValues = chain.OriginalQuantityNums |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeMarketplaceMerchantValues = chain.MarketplaceMerchantNums //市商数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterMarketplaceMerchantValues = chain.MarketplaceMerchantNums |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeDevelopmentCommitteeValues = chain.DevelopmentCommittee //发展委员会 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterDevelopmentCommitteeValues = chain.DevelopmentCommittee |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforePublicWelfareAndCharityValues = chain.PublicWelfareAndCharity //公益慈善 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterPublicWelfareAndCharityValues = chain.PublicWelfareAndCharity |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeStarLevelDividendsValues = chain.StarLevelDividends //星级分红 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterStarLevelDividendsValues = chain.StarLevelDividends |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeCommunityDividends = chain.CommunityDividends //社区分红 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterCommunityDividends = chain.CommunityDividends |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeDestructionQuantityValues = chain.DestructionQuantityNums //销毁数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterDestructionQuantityValues = chain.DestructionQuantityNums |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOriginalQuantityFundValues = chain.OriginalFunds //原始资金 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOriginalQuantityFundValues = chain.OriginalFunds |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeMarketplaceMerchantFundValues = chain.MarketplaceMerchantFunds //市商资金 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterMarketplaceMerchantFundValues = chain.MarketplaceMerchantFunds |
|
|
|
case int(enum.AccountBalanceExchangeEggEnergy): //余额兑换蛋蛋能量 |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeMarketplaceMerchantValues = eggEnergyCoreData.MarketplaceMerchantNums //市商数量 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterMarketplaceMerchantValues = eggEnergyCoreData.MarketplaceMerchantNums |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeMarketplaceMerchantFundValues = eggEnergyCoreData.MarketplaceMerchantFunds //市商资金 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterMarketplaceMerchantFundValues = eggEnergyCoreData.MarketplaceMerchantFunds |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeDevelopmentCommitteeValues = eggEnergyCoreData.DevelopmentCommittee //发展委员会 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterDevelopmentCommitteeValues = eggEnergyCoreData.DevelopmentCommittee |
|
|
|
eggEnergyAvailableEnergyFlow.BeforePublicWelfareAndCharityValues = eggEnergyCoreData.PublicWelfareAndCharity //公益慈善 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterPublicWelfareAndCharityValues = eggEnergyCoreData.PublicWelfareAndCharity |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeStarLevelDividendsValues = eggEnergyCoreData.StarLevelDividends //星级分红 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterStarLevelDividendsValues = eggEnergyCoreData.StarLevelDividends |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeCommunityDividends = eggEnergyCoreData.CommunityDividends //社区分红 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterCommunityDividends = eggEnergyCoreData.CommunityDividends |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeDestructionQuantityValues = eggEnergyCoreData.DestructionQuantityNums //销毁数量 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterDestructionQuantityValues = eggEnergyCoreData.DestructionQuantityNums |
|
|
|
break |
|
|
|
case int(enum.SignInReward): //签到奖励 |
|
|
|
beforeTotalActiveGiveaways, _ := decimal.NewFromString(chain.TotalActiveGiveaways) |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.Direction = 1 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeEcologicalApplicationValues = chain.EcologicalApplication //生态应用 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterEcologicalApplicationValues = chain.EcologicalApplication |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeTechnicalTeamValues = chain.TotalTechnologyTeam //技术团队 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterTechnicalTeamValues = chain.TotalTechnologyTeam |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOperateTeamValues = chain.TotalOperateTeam //运营团队 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOperateTeamValues = chain.TotalOperateTeam |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeActiveGiveawaysValues = chain.TotalActiveGiveaways //活跃赠送 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterActiveGiveawaysValues = beforeTotalActiveGiveaways.Sub(amountValue).RoundFloor(8).String() |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOriginalQuantityValues = chain.OriginalQuantityNums //原始数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOriginalQuantityValues = chain.OriginalQuantityNums |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeMarketplaceMerchantValues = chain.MarketplaceMerchantNums //市商数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterMarketplaceMerchantValues = chain.MarketplaceMerchantNums |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeDevelopmentCommitteeValues = chain.DevelopmentCommittee //发展委员会 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterDevelopmentCommitteeValues = chain.DevelopmentCommittee |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforePublicWelfareAndCharityValues = chain.PublicWelfareAndCharity //公益慈善 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterPublicWelfareAndCharityValues = chain.PublicWelfareAndCharity |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeStarLevelDividendsValues = chain.StarLevelDividends //星级分红 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterStarLevelDividendsValues = chain.StarLevelDividends |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeCommunityDividends = chain.CommunityDividends //社区分红 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterCommunityDividends = chain.CommunityDividends |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeDestructionQuantityValues = chain.DestructionQuantityNums //销毁数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterDestructionQuantityValues = chain.DestructionQuantityNums |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeMarketplaceMerchantFundValues = chain.MarketplaceMerchantFunds //市商资金 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterMarketplaceMerchantFundValues = chain.MarketplaceMerchantFunds |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOriginalQuantityFundValues = chain.OriginalFunds //原始资金 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOriginalQuantityFundValues = chain.OriginalFunds |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeMarketplaceMerchantFundValues = chain.MarketplaceMerchantFunds //市商资金 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterMarketplaceMerchantFundValues = chain.MarketplaceMerchantFunds |
|
|
|
break |
|
|
|
case int(enum.AccountBalanceExchange): //账户余额兑换 |
|
|
|
beforeOriginalQuantity, _ := decimal.NewFromString(chain.OriginalQuantityNums) |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.Direction = 1 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeEcologicalApplicationValues = chain.EcologicalApplication //生态应用 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterEcologicalApplicationValues = chain.EcologicalApplication |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeTechnicalTeamValues = chain.TotalTechnologyTeam //技术团队 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterTechnicalTeamValues = chain.TotalTechnologyTeam |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOperateTeamValues = chain.TotalOperateTeam //运营团队 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOperateTeamValues = chain.TotalOperateTeam |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeActiveGiveawaysValues = chain.TotalActiveGiveaways //活跃赠送 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterActiveGiveawaysValues = chain.TotalActiveGiveaways |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOriginalQuantityValues = chain.OriginalQuantityNums //原始数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOriginalQuantityValues = beforeOriginalQuantity.Sub(amountValue).RoundFloor(8).String() |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeMarketplaceMerchantValues = chain.MarketplaceMerchantNums //市商数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterMarketplaceMerchantValues = chain.MarketplaceMerchantNums |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeDevelopmentCommitteeValues = chain.DevelopmentCommittee //发展委员会 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterDevelopmentCommitteeValues = chain.DevelopmentCommittee |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforePublicWelfareAndCharityValues = chain.PublicWelfareAndCharity //公益慈善 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterPublicWelfareAndCharityValues = chain.PublicWelfareAndCharity |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeStarLevelDividendsValues = chain.StarLevelDividends //星级分红 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterStarLevelDividendsValues = chain.StarLevelDividends |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeCommunityDividends = chain.CommunityDividends //社区分红 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterCommunityDividends = chain.CommunityDividends |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeDestructionQuantityValues = chain.DestructionQuantityNums //销毁数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterDestructionQuantityValues = chain.DestructionQuantityNums |
|
|
|
|
|
|
|
amountFeeValue := decimal.NewFromFloat(amountFee) //余额价值 |
|
|
|
originalFunds, _ := decimal.NewFromString(chain.OriginalFunds) //原始资金 |
|
|
|
afterOriginalFundValues := originalFunds.Add(amountFeeValue).RoundFloor(8).String() |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOriginalQuantityFundValues = chain.OriginalFunds //原始资金 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOriginalQuantityFundValues = afterOriginalFundValues |
|
|
|
|
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeMarketplaceMerchantFundValues = chain.MarketplaceMerchantFunds //市商资金 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterMarketplaceMerchantFundValues = chain.MarketplaceMerchantFunds |
|
|
|
break |
|
|
|
case int(enum.GreenEnergyExchangeBalance): //兑换账户余额 |
|
|
|
case int(enum.EggEnergyExchangeAccountBalance): //蛋蛋能量兑换余额 |
|
|
|
//查找`egg_energy_basic_setting` 基础设置 |
|
|
|
eggEnergyBasicSettingDb := implement.NewEggEnergyBasicSettingDb(session.Engine()) |
|
|
|
eggEnergyBasicSetting, err := eggEnergyBasicSettingDb.EggEnergyBasicSettingGetOneByParams(map[string]interface{}{ |
|
|
|
"key": "is_open", |
|
|
|
"value": 1, |
|
|
|
}) |
|
|
|
var destructionSetting *md2.DestructionSettingStruct |
|
|
|
err := json.Unmarshal([]byte(chain.DestructionSetting), &destructionSetting) |
|
|
|
err = json.Unmarshal([]byte(eggEnergyBasicSetting.DestructionSetting), &destructionSetting) |
|
|
|
if err != nil { |
|
|
|
return err |
|
|
|
} |
|
|
|
decimalRate := decimal.NewFromInt(100) //百分比 |
|
|
|
amountFeeValue := decimal.NewFromFloat(amountFee) //手续费 |
|
|
|
|
|
|
|
marketplaceMerchantNums, _ := decimal.NewFromString(chain.MarketplaceMerchantNums) |
|
|
|
marketplaceMerchant, _ := decimal.NewFromString(destructionSetting.MarketplaceMerchant) //市商数量百分比 |
|
|
|
afterMarketplaceMerchantValues := marketplaceMerchantNums.Add(amountFeeValue.Mul(marketplaceMerchant.Div(decimalRate))).RoundFloor(8).String() |
|
|
|
|
|
|
|
developmentCommitteeNums, _ := decimal.NewFromString(chain.DevelopmentCommittee) |
|
|
|
developmentCommittee, _ := decimal.NewFromString(destructionSetting.DevelopmentCommittee) //发展委员会百分比 |
|
|
|
afterDevelopmentCommitteeValues := developmentCommitteeNums.Add(amountFeeValue.Mul(developmentCommittee.Div(decimalRate))).RoundFloor(8).String() |
|
|
|
|
|
|
|
publicWelfareAndCharityNums, _ := decimal.NewFromString(chain.PublicWelfareAndCharity) |
|
|
|
publicWelfareAndCharity, _ := decimal.NewFromString(destructionSetting.PublicWelfareAndCharity) //公益慈善百分比 |
|
|
|
afterPublicWelfareAndCharityValues := publicWelfareAndCharityNums.Add(amountFeeValue.Mul(publicWelfareAndCharity.Div(decimalRate))).RoundFloor(8).String() |
|
|
|
|
|
|
|
starLevelDividendsNums, _ := decimal.NewFromString(chain.StarLevelDividends) |
|
|
|
starLevelDividends, _ := decimal.NewFromString(destructionSetting.StarLevelDividends) //星级分红百分比 |
|
|
|
afterStarLevelDividendsValues := starLevelDividendsNums.Add(amountFeeValue.Mul(starLevelDividends.Div(decimalRate))).RoundFloor(8).String() |
|
|
|
|
|
|
|
var afterCommunityDividendsValues = chain.CommunityDividends |
|
|
|
if chain.CommunityDividends != "" { |
|
|
|
communityDividendsNums, _ := decimal.NewFromString(chain.CommunityDividends) |
|
|
|
communityDividends, _ := decimal.NewFromString(destructionSetting.CommunityDividends) //社区分红百分比 |
|
|
|
afterCommunityDividendsValues = communityDividendsNums.Add(amountFeeValue.Mul(communityDividends.Div(decimalRate))).RoundFloor(8).String() |
|
|
|
} |
|
|
|
|
|
|
|
destructionQuantityNums, _ := decimal.NewFromString(chain.DestructionQuantityNums) |
|
|
|
destructionQuantity, _ := decimal.NewFromString(destructionSetting.DestructionQuantity) //销毁百分比 |
|
|
|
afterDestructionQuantityValues := destructionQuantityNums.Add(amountFeeValue.Mul(destructionQuantity.Div(decimalRate))).RoundFloor(8).String() |
|
|
|
|
|
|
|
originalQuantityNums, _ := decimal.NewFromString(chain.OriginalQuantityNums) //原始数量 |
|
|
|
afterOriginalQuantityValues := originalQuantityNums.Add(amountValue.Sub(amountFeeValue)).RoundFloor(8).String() |
|
|
|
|
|
|
|
originalFunds, _ := decimal.NewFromString(chain.OriginalFunds) //原始资金 |
|
|
|
afterOriginalFundValues := originalFunds.Sub(nowPrice.Mul(amountValue.Sub(amountFeeValue))).RoundFloor(8).String() |
|
|
|
|
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.Direction = 1 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeEcologicalApplicationValues = chain.EcologicalApplication //生态应用 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterEcologicalApplicationValues = chain.EcologicalApplication |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeTechnicalTeamValues = chain.TotalTechnologyTeam //技术团队 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterTechnicalTeamValues = chain.TotalTechnologyTeam |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOperateTeamValues = chain.TotalOperateTeam //运营团队 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOperateTeamValues = chain.TotalOperateTeam |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeActiveGiveawaysValues = chain.TotalActiveGiveaways //活跃赠送 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterActiveGiveawaysValues = chain.TotalActiveGiveaways |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOriginalQuantityValues = chain.OriginalQuantityNums //原始数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOriginalQuantityValues = afterOriginalQuantityValues |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeMarketplaceMerchantValues = chain.MarketplaceMerchantNums //市商数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterMarketplaceMerchantValues = afterMarketplaceMerchantValues |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterMarketplaceMerchantValues = afterMarketplaceMerchantValues |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeDevelopmentCommitteeValues = chain.DevelopmentCommittee //发展委员会 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterDevelopmentCommitteeValues = afterDevelopmentCommitteeValues |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforePublicWelfareAndCharityValues = chain.PublicWelfareAndCharity //公益慈善 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterPublicWelfareAndCharityValues = afterPublicWelfareAndCharityValues |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeStarLevelDividendsValues = chain.StarLevelDividends //星级分红 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterStarLevelDividendsValues = afterStarLevelDividendsValues |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeCommunityDividends = chain.CommunityDividends //社区分红百分比 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterCommunityDividends = afterCommunityDividendsValues |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeDestructionQuantityValues = chain.DestructionQuantityNums //销毁数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterDestructionQuantityValues = afterDestructionQuantityValues |
|
|
|
|
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeMarketplaceMerchantFundValues = chain.MarketplaceMerchantFunds //市商资金 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterMarketplaceMerchantFundValues = chain.MarketplaceMerchantFunds |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOriginalQuantityFundValues = chain.OriginalFunds //原始资金 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOriginalQuantityFundValues = afterOriginalFundValues |
|
|
|
|
|
|
|
//TODO::新增 / 更新 one_circles_star_level_dividends_records 记录 |
|
|
|
oneCirclesStarLevelDividendsRecords, err := db.OneCirclesStarLevelDividendsRecordsGetOneByParamsBySession(session, map[string]interface{}{ |
|
|
|
decimalRate := decimal.NewFromInt(100) //百分比 |
|
|
|
amountFeeValue, _ := decimal.NewFromString(req.AmountFee) //手续费 |
|
|
|
|
|
|
|
marketplaceMerchantNums, _ := decimal.NewFromString(eggEnergyCoreData.MarketplaceMerchantNums) //市商数量 |
|
|
|
marketplaceMerchant, _ := decimal.NewFromString(destructionSetting.MarketplaceMerchant) |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeMarketplaceMerchantValues = eggEnergyCoreData.MarketplaceMerchantNums |
|
|
|
eggEnergyAvailableEnergyFlow.AfterMarketplaceMerchantValues = marketplaceMerchantNums.Add(amountFeeValue.Mul(marketplaceMerchant.Div(decimalRate))).RoundFloor(8).String() |
|
|
|
|
|
|
|
eggEnergyAvailableEnergyFlow.BeforeMarketplaceMerchantFundValues = eggEnergyCoreData.MarketplaceMerchantFunds //市商资金 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterMarketplaceMerchantFundValues = eggEnergyCoreData.MarketplaceMerchantFunds |
|
|
|
|
|
|
|
developmentCommitteeNums, _ := decimal.NewFromString(eggEnergyCoreData.DevelopmentCommittee) //发展委员会 |
|
|
|
developmentCommittee, _ := decimal.NewFromString(destructionSetting.DevelopmentCommittee) |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeDevelopmentCommitteeValues = eggEnergyCoreData.DevelopmentCommittee |
|
|
|
eggEnergyAvailableEnergyFlow.AfterDevelopmentCommitteeValues = developmentCommitteeNums.Add(amountFeeValue.Mul(developmentCommittee.Div(decimalRate))).RoundFloor(8).String() |
|
|
|
|
|
|
|
publicWelfareAndCharityNums, _ := decimal.NewFromString(eggEnergyCoreData.PublicWelfareAndCharity) //公益慈善 |
|
|
|
publicWelfareAndCharity, _ := decimal.NewFromString(destructionSetting.PublicWelfareAndCharity) |
|
|
|
eggEnergyAvailableEnergyFlow.BeforePublicWelfareAndCharityValues = eggEnergyCoreData.PublicWelfareAndCharity |
|
|
|
eggEnergyAvailableEnergyFlow.AfterPublicWelfareAndCharityValues = publicWelfareAndCharityNums.Add(amountFeeValue.Mul(publicWelfareAndCharity.Div(decimalRate))).RoundFloor(8).String() |
|
|
|
|
|
|
|
starLevelDividendsNums, _ := decimal.NewFromString(eggEnergyCoreData.StarLevelDividends) //星级分红 |
|
|
|
starLevelDividends, _ := decimal.NewFromString(destructionSetting.StarLevelDividends) |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeStarLevelDividendsValues = eggEnergyCoreData.StarLevelDividends |
|
|
|
eggEnergyAvailableEnergyFlow.AfterStarLevelDividendsValues = starLevelDividendsNums.Add(amountFeeValue.Mul(starLevelDividends.Div(decimalRate))).RoundFloor(8).String() |
|
|
|
|
|
|
|
eggEnergyAvailableEnergyFlow.BeforeCommunityDividends = eggEnergyCoreData.CommunityDividends //社区分红 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterCommunityDividends = eggEnergyCoreData.CommunityDividends |
|
|
|
|
|
|
|
destructionQuantityNums, _ := decimal.NewFromString(eggEnergyCoreData.DestructionQuantityNums) //销毁数量 |
|
|
|
destructionQuantity, _ := decimal.NewFromString(destructionSetting.DestructionQuantity) |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeStarLevelDividendsValues = eggEnergyCoreData.DestructionQuantityNums |
|
|
|
eggEnergyAvailableEnergyFlow.AfterStarLevelDividendsValues = destructionQuantityNums.Add(amountFeeValue.Mul(destructionQuantity.Div(decimalRate))).RoundFloor(8).String() |
|
|
|
|
|
|
|
//TODO::新增 / 更新 egg_star_level_dividends_records 记录 |
|
|
|
eggStarLevelDividendsRecordsDb := implement.NewEggStarLevelDividendsRecordsDb(session.Engine()) |
|
|
|
eggStarLevelDividendsRecords, err1 := eggStarLevelDividendsRecordsDb.EggStarLevelDividendsRecordsGetOneByParamsBySession(session, map[string]interface{}{ |
|
|
|
"key": "date", |
|
|
|
"value": now.Format("2006-01-02"), |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
|
return err |
|
|
|
if err1 != nil { |
|
|
|
return err1 |
|
|
|
} |
|
|
|
if oneCirclesStarLevelDividendsRecords == nil { |
|
|
|
oneCirclesStarLevelDividendsRecords = &model.OneCirclesStarLevelDividendsRecords{ |
|
|
|
if eggStarLevelDividendsRecords == nil { |
|
|
|
eggStarLevelDividendsRecords = &model.EggStarLevelDividendsRecords{ |
|
|
|
Amount: amountFeeValue.Mul(starLevelDividends.Div(decimalRate)).String(), |
|
|
|
AlreadyDividendsAmount: "", |
|
|
|
NotDividendsAmount: "", |
|
|
|
Date: now.Format("2006-01-02"), |
|
|
|
} |
|
|
|
_, err = db.OneCirclesStarLevelDividendsRecordsInsertBySession(session, oneCirclesStarLevelDividendsRecords) |
|
|
|
_, err = eggStarLevelDividendsRecordsDb.EggStarLevelDividendsRecordsInsertBySession(session, eggStarLevelDividendsRecords) |
|
|
|
if err != nil { |
|
|
|
return err |
|
|
|
} |
|
|
|
} else { |
|
|
|
oneCirclesStarLevelDividendsRecordsAmountValue, _ := decimal.NewFromString(oneCirclesStarLevelDividendsRecords.Amount) |
|
|
|
oneCirclesStarLevelDividendsRecordsAmountValue = oneCirclesStarLevelDividendsRecordsAmountValue.Add(amountFeeValue.Mul(starLevelDividends.Div(decimalRate))) |
|
|
|
oneCirclesStarLevelDividendsRecords.Amount = oneCirclesStarLevelDividendsRecordsAmountValue.String() |
|
|
|
_, err = db.OneCirclesStarLevelDividendsRecordsUpdateBySession(session, oneCirclesStarLevelDividendsRecords.Id, oneCirclesStarLevelDividendsRecords, "amount") |
|
|
|
eggStarLevelDividendsRecordsAmountValue, _ := decimal.NewFromString(eggStarLevelDividendsRecords.Amount) |
|
|
|
eggStarLevelDividendsRecordsAmountValue = eggStarLevelDividendsRecordsAmountValue.Add(amountFeeValue.Mul(starLevelDividends.Div(decimalRate))) |
|
|
|
eggStarLevelDividendsRecords.Amount = eggStarLevelDividendsRecordsAmountValue.String() |
|
|
|
_, err = eggStarLevelDividendsRecordsDb.EggStarLevelDividendsRecordsUpdateBySession(session, eggStarLevelDividendsRecords.Id, eggStarLevelDividendsRecords, "amount") |
|
|
|
if err != nil { |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
break |
|
|
|
case int(enum.SettlementStarLevelDividends): //星级分红 |
|
|
|
beforeStarLevelDividends, _ := decimal.NewFromString(chain.StarLevelDividends) |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.Direction = 1 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeEcologicalApplicationValues = chain.EcologicalApplication //生态应用 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterEcologicalApplicationValues = chain.EcologicalApplication |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeTechnicalTeamValues = chain.TotalTechnologyTeam //技术团队 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterTechnicalTeamValues = chain.TotalTechnologyTeam |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOperateTeamValues = chain.TotalOperateTeam //运营团队 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOperateTeamValues = chain.TotalOperateTeam |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeActiveGiveawaysValues = chain.TotalActiveGiveaways //活跃赠送 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterActiveGiveawaysValues = chain.TotalActiveGiveaways |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOriginalQuantityValues = chain.OriginalQuantityNums //原始数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOriginalQuantityValues = chain.OriginalQuantityNums |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeMarketplaceMerchantValues = chain.MarketplaceMerchantNums //市商数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterMarketplaceMerchantValues = chain.MarketplaceMerchantNums |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeDevelopmentCommitteeValues = chain.DevelopmentCommittee //发展委员会 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterDevelopmentCommitteeValues = chain.DevelopmentCommittee |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforePublicWelfareAndCharityValues = chain.PublicWelfareAndCharity //公益慈善 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterPublicWelfareAndCharityValues = chain.PublicWelfareAndCharity |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeStarLevelDividendsValues = chain.StarLevelDividends //星级分红 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterStarLevelDividendsValues = beforeStarLevelDividends.Sub(amountValue).RoundFloor(8).String() |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeCommunityDividends = chain.CommunityDividends //社区分红 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterCommunityDividends = chain.CommunityDividends |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeDestructionQuantityValues = chain.DestructionQuantityNums //销毁数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterDestructionQuantityValues = chain.DestructionQuantityNums |
|
|
|
|
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOriginalQuantityFundValues = chain.OriginalFunds //原始资金 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOriginalQuantityFundValues = chain.OriginalFunds |
|
|
|
|
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeMarketplaceMerchantFundValues = chain.MarketplaceMerchantFunds //市商资金 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterMarketplaceMerchantFundValues = chain.MarketplaceMerchantFunds |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeMarketplaceMerchantValues = eggEnergyCoreData.MarketplaceMerchantNums //市商数量 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterMarketplaceMerchantValues = eggEnergyCoreData.MarketplaceMerchantNums |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeMarketplaceMerchantFundValues = eggEnergyCoreData.MarketplaceMerchantFunds //市商资金 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterMarketplaceMerchantFundValues = eggEnergyCoreData.MarketplaceMerchantFunds |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeDevelopmentCommitteeValues = eggEnergyCoreData.DevelopmentCommittee //发展委员会 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterDevelopmentCommitteeValues = eggEnergyCoreData.DevelopmentCommittee |
|
|
|
eggEnergyAvailableEnergyFlow.BeforePublicWelfareAndCharityValues = eggEnergyCoreData.PublicWelfareAndCharity //公益慈善 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterPublicWelfareAndCharityValues = eggEnergyCoreData.PublicWelfareAndCharity |
|
|
|
|
|
|
|
starLevelDividends, _ := decimal.NewFromString(eggEnergyCoreData.StarLevelDividends) //星级分红 |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeStarLevelDividendsValues = eggEnergyCoreData.StarLevelDividends |
|
|
|
eggEnergyAvailableEnergyFlow.AfterStarLevelDividendsValues = starLevelDividends.Sub(amountValue).RoundFloor(8).String() |
|
|
|
|
|
|
|
eggEnergyAvailableEnergyFlow.BeforeCommunityDividends = eggEnergyCoreData.CommunityDividends //社区分红 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterCommunityDividends = eggEnergyCoreData.CommunityDividends |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeDestructionQuantityValues = eggEnergyCoreData.DestructionQuantityNums //销毁数量 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterDestructionQuantityValues = eggEnergyCoreData.DestructionQuantityNums |
|
|
|
break |
|
|
|
case int(enum.CommunityDividends): //社区分红 |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeMarketplaceMerchantValues = eggEnergyCoreData.MarketplaceMerchantNums //市商数量 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterMarketplaceMerchantValues = eggEnergyCoreData.MarketplaceMerchantNums |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeMarketplaceMerchantFundValues = eggEnergyCoreData.MarketplaceMerchantFunds //市商资金 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterMarketplaceMerchantFundValues = eggEnergyCoreData.MarketplaceMerchantFunds |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeDevelopmentCommitteeValues = eggEnergyCoreData.DevelopmentCommittee //发展委员会 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterDevelopmentCommitteeValues = eggEnergyCoreData.DevelopmentCommittee |
|
|
|
eggEnergyAvailableEnergyFlow.BeforePublicWelfareAndCharityValues = eggEnergyCoreData.PublicWelfareAndCharity //公益慈善 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterPublicWelfareAndCharityValues = eggEnergyCoreData.PublicWelfareAndCharity |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeStarLevelDividendsValues = eggEnergyCoreData.StarLevelDividends //星级分红 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterStarLevelDividendsValues = eggEnergyCoreData.StarLevelDividends |
|
|
|
|
|
|
|
communityDividends, _ := decimal.NewFromString(eggEnergyCoreData.CommunityDividends) //社区分红 |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeCommunityDividends = eggEnergyCoreData.CommunityDividends |
|
|
|
eggEnergyAvailableEnergyFlow.AfterCommunityDividends = communityDividends.Add(amountValue).RoundFloor(8).String() |
|
|
|
|
|
|
|
eggEnergyAvailableEnergyFlow.BeforeDestructionQuantityValues = eggEnergyCoreData.DestructionQuantityNums //销毁数量 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterDestructionQuantityValues = eggEnergyCoreData.DestructionQuantityNums |
|
|
|
break |
|
|
|
case int(enum.PlatformProfitability): //平台盈利 |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeMarketplaceMerchantValues = eggEnergyCoreData.MarketplaceMerchantNums //市商数量 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterMarketplaceMerchantValues = eggEnergyCoreData.MarketplaceMerchantNums |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeMarketplaceMerchantFundValues = eggEnergyCoreData.MarketplaceMerchantFunds //市商资金 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterMarketplaceMerchantFundValues = eggEnergyCoreData.MarketplaceMerchantFunds |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeDevelopmentCommitteeValues = eggEnergyCoreData.DevelopmentCommittee //发展委员会 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterDevelopmentCommitteeValues = eggEnergyCoreData.DevelopmentCommittee |
|
|
|
eggEnergyAvailableEnergyFlow.BeforePublicWelfareAndCharityValues = eggEnergyCoreData.PublicWelfareAndCharity //公益慈善 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterPublicWelfareAndCharityValues = eggEnergyCoreData.PublicWelfareAndCharity |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeStarLevelDividendsValues = eggEnergyCoreData.StarLevelDividends //星级分红 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterStarLevelDividendsValues = eggEnergyCoreData.StarLevelDividends |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeCommunityDividends = eggEnergyCoreData.CommunityDividends //社区分红 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterCommunityDividends = eggEnergyCoreData.CommunityDividends |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeDestructionQuantityValues = eggEnergyCoreData.DestructionQuantityNums //销毁数量 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterDestructionQuantityValues = eggEnergyCoreData.DestructionQuantityNums |
|
|
|
break |
|
|
|
case int(enum.MarketplaceMerchantNumsAutoExchangeMarketplaceMerchantFunds): //市商数量自动兑换市商资金 |
|
|
|
beforeOriginalQuantityNums, _ := decimal.NewFromString(chain.OriginalQuantityNums) |
|
|
|
beforeMarketplaceMerchantNums, _ := decimal.NewFromString(chain.MarketplaceMerchantNums) |
|
|
|
beforeOriginalFunds, _ := decimal.NewFromString(chain.OriginalFunds) |
|
|
|
beforeMarketplaceMerchantFunds, _ := decimal.NewFromString(chain.MarketplaceMerchantFunds) |
|
|
|
|
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.Direction = 1 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeEcologicalApplicationValues = chain.EcologicalApplication //生态应用 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterEcologicalApplicationValues = chain.EcologicalApplication |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeTechnicalTeamValues = chain.TotalTechnologyTeam //技术团队 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterTechnicalTeamValues = chain.TotalTechnologyTeam |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOperateTeamValues = chain.TotalOperateTeam //运营团队 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOperateTeamValues = chain.TotalOperateTeam |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeActiveGiveawaysValues = chain.TotalActiveGiveaways //活跃赠送 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterActiveGiveawaysValues = chain.TotalActiveGiveaways |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOriginalQuantityValues = chain.OriginalQuantityNums //原始数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOriginalQuantityValues = beforeOriginalQuantityNums.Add(amountValue).String() |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeMarketplaceMerchantValues = chain.MarketplaceMerchantNums //市商数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterMarketplaceMerchantValues = beforeMarketplaceMerchantNums.Sub(amountValue).String() |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeDevelopmentCommitteeValues = chain.DevelopmentCommittee //发展委员会 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterDevelopmentCommitteeValues = chain.DevelopmentCommittee |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforePublicWelfareAndCharityValues = chain.PublicWelfareAndCharity //公益慈善 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterPublicWelfareAndCharityValues = chain.PublicWelfareAndCharity |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeStarLevelDividendsValues = chain.StarLevelDividends //星级分红 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterStarLevelDividendsValues = chain.StarLevelDividends //星级分红 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeCommunityDividends = chain.CommunityDividends //社区分红 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterCommunityDividends = chain.CommunityDividends |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeDestructionQuantityValues = chain.DestructionQuantityNums //销毁数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterDestructionQuantityValues = chain.DestructionQuantityNums |
|
|
|
|
|
|
|
amountFeeValue := decimal.NewFromFloat(amountFee) //金额 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOriginalQuantityFundValues = chain.OriginalFunds //原始资金 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOriginalQuantityFundValues = beforeOriginalFunds.Sub(amountFeeValue).String() |
|
|
|
|
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeMarketplaceMerchantFundValues = chain.MarketplaceMerchantFunds //市商资金 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterMarketplaceMerchantFundValues = beforeMarketplaceMerchantFunds.Add(amountFeeValue).String() |
|
|
|
marketplaceMerchantNums, _ := decimal.NewFromString(eggEnergyCoreData.MarketplaceMerchantNums) //市商数量 |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeMarketplaceMerchantValues = eggEnergyCoreData.MarketplaceMerchantNums |
|
|
|
eggEnergyAvailableEnergyFlow.AfterMarketplaceMerchantValues = marketplaceMerchantNums.Sub(amountValue).RoundFloor(8).String() |
|
|
|
|
|
|
|
eggEnergyAvailableEnergyFlow.BeforeMarketplaceMerchantFundValues = eggEnergyCoreData.MarketplaceMerchantFunds //市商资金 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterMarketplaceMerchantFundValues = eggEnergyCoreData.MarketplaceMerchantFunds |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeDevelopmentCommitteeValues = eggEnergyCoreData.DevelopmentCommittee //发展委员会 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterDevelopmentCommitteeValues = eggEnergyCoreData.DevelopmentCommittee |
|
|
|
eggEnergyAvailableEnergyFlow.BeforePublicWelfareAndCharityValues = eggEnergyCoreData.PublicWelfareAndCharity //公益慈善 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterPublicWelfareAndCharityValues = eggEnergyCoreData.PublicWelfareAndCharity |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeStarLevelDividendsValues = eggEnergyCoreData.StarLevelDividends //星级分红 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterStarLevelDividendsValues = eggEnergyCoreData.StarLevelDividends |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeCommunityDividends = eggEnergyCoreData.CommunityDividends //社区分红 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterCommunityDividends = eggEnergyCoreData.CommunityDividends |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeDestructionQuantityValues = eggEnergyCoreData.DestructionQuantityNums //销毁数量 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterDestructionQuantityValues = eggEnergyCoreData.DestructionQuantityNums |
|
|
|
break |
|
|
|
case int(enum.MarketplaceMerchantFundsAutoExchangeMarketplaceMerchantNums): //市商资金自动兑换市商数量 |
|
|
|
beforeOriginalQuantityNums, _ := decimal.NewFromString(chain.OriginalQuantityNums) |
|
|
|
beforeMarketplaceMerchantNums, _ := decimal.NewFromString(chain.MarketplaceMerchantNums) |
|
|
|
beforeOriginalFunds, _ := decimal.NewFromString(chain.OriginalFunds) |
|
|
|
beforeMarketplaceMerchantFunds, _ := decimal.NewFromString(chain.MarketplaceMerchantFunds) |
|
|
|
|
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.Direction = 1 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeEcologicalApplicationValues = chain.EcologicalApplication //生态应用 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterEcologicalApplicationValues = chain.EcologicalApplication |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeTechnicalTeamValues = chain.TotalTechnologyTeam //技术团队 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterTechnicalTeamValues = chain.TotalTechnologyTeam |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOperateTeamValues = chain.TotalOperateTeam //运营团队 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOperateTeamValues = chain.TotalOperateTeam |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeActiveGiveawaysValues = chain.TotalActiveGiveaways //活跃赠送 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterActiveGiveawaysValues = chain.TotalActiveGiveaways |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOriginalQuantityValues = chain.OriginalQuantityNums //原始数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOriginalQuantityValues = beforeOriginalQuantityNums.Sub(amountValue).String() |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeMarketplaceMerchantValues = chain.MarketplaceMerchantNums //市商数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterMarketplaceMerchantValues = beforeMarketplaceMerchantNums.Add(amountValue).String() |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeDevelopmentCommitteeValues = chain.DevelopmentCommittee //发展委员会 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterDevelopmentCommitteeValues = chain.DevelopmentCommittee |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforePublicWelfareAndCharityValues = chain.PublicWelfareAndCharity //公益慈善 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterPublicWelfareAndCharityValues = chain.PublicWelfareAndCharity |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeStarLevelDividendsValues = chain.StarLevelDividends //星级分红 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterStarLevelDividendsValues = chain.StarLevelDividends //星级分红 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeCommunityDividends = chain.CommunityDividends //社区分红 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterCommunityDividends = chain.CommunityDividends |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeDestructionQuantityValues = chain.DestructionQuantityNums //销毁数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterDestructionQuantityValues = chain.DestructionQuantityNums |
|
|
|
|
|
|
|
amountFeeValue := decimal.NewFromFloat(amountFee) //金额 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOriginalQuantityFundValues = chain.OriginalFunds //原始资金 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOriginalQuantityFundValues = beforeOriginalFunds.Add(amountFeeValue).String() |
|
|
|
|
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeMarketplaceMerchantFundValues = chain.MarketplaceMerchantFunds //市商资金 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterMarketplaceMerchantFundValues = beforeMarketplaceMerchantFunds.Sub(amountFeeValue).String() |
|
|
|
break |
|
|
|
case int(enum.CommunityDividends): //社区分红 |
|
|
|
beforeCommunityDividends, _ := decimal.NewFromString(chain.CommunityDividends) |
|
|
|
|
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.Direction = 2 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeEcologicalApplicationValues = chain.EcologicalApplication //生态应用 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterEcologicalApplicationValues = chain.EcologicalApplication |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeTechnicalTeamValues = chain.TotalTechnologyTeam //技术团队 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterTechnicalTeamValues = chain.TotalTechnologyTeam |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOperateTeamValues = chain.TotalOperateTeam //运营团队 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOperateTeamValues = chain.TotalOperateTeam |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeActiveGiveawaysValues = chain.TotalActiveGiveaways //活跃赠送 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterActiveGiveawaysValues = chain.TotalActiveGiveaways |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOriginalQuantityValues = chain.OriginalQuantityNums //原始数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOriginalQuantityValues = chain.OriginalQuantityNums |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeMarketplaceMerchantValues = chain.MarketplaceMerchantNums //市商数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterMarketplaceMerchantValues = chain.MarketplaceMerchantNums |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeDevelopmentCommitteeValues = chain.DevelopmentCommittee //发展委员会 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterDevelopmentCommitteeValues = chain.DevelopmentCommittee |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforePublicWelfareAndCharityValues = chain.PublicWelfareAndCharity //公益慈善 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterPublicWelfareAndCharityValues = chain.PublicWelfareAndCharity |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeStarLevelDividendsValues = chain.StarLevelDividends //星级分红 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterStarLevelDividendsValues = chain.StarLevelDividends //星级分红 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeDestructionQuantityValues = chain.DestructionQuantityNums //销毁数量 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterDestructionQuantityValues = chain.DestructionQuantityNums |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeOriginalQuantityFundValues = chain.OriginalFunds //原始资金 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterOriginalQuantityFundValues = chain.OriginalFunds |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeMarketplaceMerchantFundValues = chain.MarketplaceMerchantFunds //市商资金 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterMarketplaceMerchantFundValues = chain.MarketplaceMerchantFunds |
|
|
|
|
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforeCommunityDividends = chain.CommunityDividends //社区分红 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterCommunityDividends = beforeCommunityDividends.Sub(amountValue).RoundFloor(8).String() |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeMarketplaceMerchantValues = eggEnergyCoreData.MarketplaceMerchantNums //市商数量 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterMarketplaceMerchantValues = eggEnergyCoreData.MarketplaceMerchantNums |
|
|
|
|
|
|
|
marketplaceMerchantFunds, _ := decimal.NewFromString(eggEnergyCoreData.MarketplaceMerchantFunds) //市商资金 |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeMarketplaceMerchantFundValues = eggEnergyCoreData.MarketplaceMerchantFunds |
|
|
|
eggEnergyAvailableEnergyFlow.AfterMarketplaceMerchantFundValues = marketplaceMerchantFunds.Sub(amountValue).RoundFloor(8).String() |
|
|
|
|
|
|
|
eggEnergyAvailableEnergyFlow.BeforeDevelopmentCommitteeValues = eggEnergyCoreData.DevelopmentCommittee //发展委员会 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterDevelopmentCommitteeValues = eggEnergyCoreData.DevelopmentCommittee |
|
|
|
eggEnergyAvailableEnergyFlow.BeforePublicWelfareAndCharityValues = eggEnergyCoreData.PublicWelfareAndCharity //公益慈善 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterPublicWelfareAndCharityValues = eggEnergyCoreData.PublicWelfareAndCharity |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeStarLevelDividendsValues = eggEnergyCoreData.StarLevelDividends //星级分红 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterStarLevelDividendsValues = eggEnergyCoreData.StarLevelDividends |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeCommunityDividends = eggEnergyCoreData.CommunityDividends //社区分红 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterCommunityDividends = eggEnergyCoreData.CommunityDividends |
|
|
|
eggEnergyAvailableEnergyFlow.BeforeDestructionQuantityValues = eggEnergyCoreData.DestructionQuantityNums //销毁数量 |
|
|
|
eggEnergyAvailableEnergyFlow.AfterDestructionQuantityValues = eggEnergyCoreData.DestructionQuantityNums |
|
|
|
break |
|
|
|
} |
|
|
|
|
|
|
|
chain.EcologicalApplication = oneCirclesAvailableGreenEnergyPointsFlow.AfterEcologicalApplicationValues //生态应用 |
|
|
|
chain.TotalTechnologyTeam = oneCirclesAvailableGreenEnergyPointsFlow.AfterTechnicalTeamValues //技术团队 |
|
|
|
chain.TotalOperateTeam = oneCirclesAvailableGreenEnergyPointsFlow.AfterOperateTeamValues //运营团队 |
|
|
|
chain.TotalActiveGiveaways = oneCirclesAvailableGreenEnergyPointsFlow.AfterActiveGiveawaysValues //活跃赠送 |
|
|
|
chain.OriginalQuantityNums = oneCirclesAvailableGreenEnergyPointsFlow.AfterOriginalQuantityValues //原始数量 |
|
|
|
chain.MarketplaceMerchantNums = oneCirclesAvailableGreenEnergyPointsFlow.AfterMarketplaceMerchantValues //市商数量 |
|
|
|
chain.DevelopmentCommittee = oneCirclesAvailableGreenEnergyPointsFlow.AfterDevelopmentCommitteeValues //发展委员会 |
|
|
|
chain.PublicWelfareAndCharity = oneCirclesAvailableGreenEnergyPointsFlow.AfterPublicWelfareAndCharityValues //公益慈善 |
|
|
|
chain.StarLevelDividends = oneCirclesAvailableGreenEnergyPointsFlow.AfterStarLevelDividendsValues //星级分红 |
|
|
|
chain.CommunityDividends = oneCirclesAvailableGreenEnergyPointsFlow.AfterCommunityDividends //社区分红 |
|
|
|
chain.DestructionQuantityNums = oneCirclesAvailableGreenEnergyPointsFlow.AfterDestructionQuantityValues //销毁数量 |
|
|
|
|
|
|
|
chain.OriginalFunds = oneCirclesAvailableGreenEnergyPointsFlow.AfterOriginalQuantityFundValues //原始资金 |
|
|
|
chain.MarketplaceMerchantFunds = oneCirclesAvailableGreenEnergyPointsFlow.AfterMarketplaceMerchantFundValues //市商资金 |
|
|
|
|
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.BeforePrice = chain.NowPrice //价格 |
|
|
|
oneCirclesAvailableGreenEnergyPointsFlow.AfterPrice = nowPriceValue |
|
|
|
|
|
|
|
//更新 `one_circles_green_energy_basic_setting` 表 |
|
|
|
if chain.NowPrice != nowPriceValue { |
|
|
|
chain.NowPrice = nowPriceValue |
|
|
|
} |
|
|
|
_, err := db.OneCirclesGreenEnergyBasicSettingUpdate(session, chain.Id, chain, |
|
|
|
"ecological_application", |
|
|
|
"total_technology_team", |
|
|
|
"total_operate_team", |
|
|
|
"total_active_giveaways", |
|
|
|
"original_quantity_nums", |
|
|
|
"now_price", |
|
|
|
"original_funds", |
|
|
|
"marketplace_merchant_nums", |
|
|
|
"marketplace_merchant_funds", |
|
|
|
"development_committee", |
|
|
|
"public_welfare_and_charity", |
|
|
|
"star_level_dividends", |
|
|
|
"community_dividends", |
|
|
|
"destruction_quantity_nums", |
|
|
|
//更新 `egg_energy_core_data` 表 |
|
|
|
eggEnergyCoreDataDb := implement.NewEggEnergyCoreDataDb(session.Engine()) |
|
|
|
_, err := eggEnergyCoreDataDb.EggEnergyCoreDataUpdateBySession(session, eggEnergyCoreData.Id, eggEnergyCoreData, |
|
|
|
"now_price", "planet_total_value", "now_energy_total_nums", "marketplace_merchant_nums", "marketplace_merchant_funds", |
|
|
|
"development_committee", "public_welfare_and_charity", "star_level_dividends", "community_dividends", "destruction_quantity_nums", |
|
|
|
) |
|
|
|
if err != nil { |
|
|
|
return err |
|
|
|
} |
|
|
|
|
|
|
|
//插入 `one_circles_available_green_energy_points_flow` 记录 |
|
|
|
_, err = db.OneCirclesAvailableGreenEnergyPointsFlowInsert(session, &oneCirclesAvailableGreenEnergyPointsFlow) |
|
|
|
//插入 `egg_energy_available_energy_flow` 记录 |
|
|
|
eggEnergyAvailableEnergyFlowDb := implement.NewEggEnergyAvailableEnergyFlowDb(session.Engine()) |
|
|
|
_, err = eggEnergyAvailableEnergyFlowDb.EggEnergyAvailableEnergyFlowInsertBySession(session, &eggEnergyAvailableEnergyFlow) |
|
|
|
if err != nil { |
|
|
|
return err |
|
|
|
} |
|
|
|