From 0d3528790588849d5e5e449fb6ca4ba84619a3ec Mon Sep 17 00:00:00 2001 From: dengbiao Date: Sat, 27 Jul 2024 12:18:18 +0800 Subject: [PATCH] update --- .../one_circles_auto_adjust_prices.go | 4 ++-- .../one_circles_community_dividends.go | 2 +- ...cles_deal_available_green_energy_points.go | 5 +++-- ...circles_sign_in_green_energy_settlement.go | 22 +++++++++++-------- .../one_circles_star_level_dividends.go | 2 +- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/rule/one_circles/one_circles_auto_adjust_prices.go b/rule/one_circles/one_circles_auto_adjust_prices.go index 3f100d1..56b436f 100644 --- a/rule/one_circles/one_circles_auto_adjust_prices.go +++ b/rule/one_circles/one_circles_auto_adjust_prices.go @@ -62,7 +62,7 @@ func AutoAdjustPrice(engine *xorm.Engine, masterId string) (err error) { } // 市商数量 减少、原始数量 增加、原始资金 减少、市商资金 增加 - err = DealAvailableGreenEnergyCoin(session, int(enum.MarketplaceMerchantNumsAutoExchangeMarketplaceMerchantFunds), zhios_order_relate_utils.StrToFloat64(marketplaceMerchantsNumsExchangeMarketplaceMerchantsFundValue.String()), zhios_order_relate_utils.StrToFloat64(amount), enum.MarketplaceMerchantNumsAutoExchangeMarketplaceMerchantFunds.String(), oneCirclesGreenEnergyBasicSetting, afterPriceValue) + err = DealAvailableGreenEnergyCoin(session, int(enum.MarketplaceMerchantNumsAutoExchangeMarketplaceMerchantFunds), zhios_order_relate_utils.StrToFloat64(marketplaceMerchantsNumsExchangeMarketplaceMerchantsFundValue.String()), zhios_order_relate_utils.StrToFloat64(amount), enum.MarketplaceMerchantNumsAutoExchangeMarketplaceMerchantFunds.String(), oneCirclesGreenEnergyBasicSetting, afterPriceValue, masterId) if err != nil { fmt.Println("err:::::22222", err) _ = session.Rollback() @@ -78,7 +78,7 @@ func AutoAdjustPrice(engine *xorm.Engine, masterId string) (err error) { return err1 } // 市商数量 增加、原始数量 减少、原始资金 增加、市商资金 减少 - err = DealAvailableGreenEnergyCoin(session, int(enum.MarketplaceMerchantFundsAutoExchangeMarketplaceMerchantNums), zhios_order_relate_utils.StrToFloat64(greenEnergy), zhios_order_relate_utils.StrToFloat64(marketplaceMerchantsFundExchangeMarketplaceMerchantsNumsValue.String()), enum.MarketplaceMerchantFundsAutoExchangeMarketplaceMerchantNums.String(), oneCirclesGreenEnergyBasicSetting, afterPriceValue) + err = DealAvailableGreenEnergyCoin(session, int(enum.MarketplaceMerchantFundsAutoExchangeMarketplaceMerchantNums), zhios_order_relate_utils.StrToFloat64(greenEnergy), zhios_order_relate_utils.StrToFloat64(marketplaceMerchantsFundExchangeMarketplaceMerchantsNumsValue.String()), enum.MarketplaceMerchantFundsAutoExchangeMarketplaceMerchantNums.String(), oneCirclesGreenEnergyBasicSetting, afterPriceValue, masterId) if err != nil { fmt.Println("err:::::44444", err) _ = session.Rollback() diff --git a/rule/one_circles/one_circles_community_dividends.go b/rule/one_circles/one_circles_community_dividends.go index 36a25cc..9941930 100644 --- a/rule/one_circles/one_circles_community_dividends.go +++ b/rule/one_circles/one_circles_community_dividends.go @@ -84,7 +84,7 @@ func CommunityDividends(engine *xorm.Engine, masterId string) (err error) { } //6、 减少“社区分红”钱包中的值 totalDividend, _ := totalValue.Float64() - err = DealAvailableGreenEnergyCoin(session, int(enum.CommunityDividends), totalDividend, 0, enum.CommunityDividends.String(), nil, masterId) + err = DealAvailableGreenEnergyCoin(session, int(enum.CommunityDividends), totalDividend, 0, enum.CommunityDividends.String(), nil, "", masterId) if err != nil { _ = session.Rollback() fmt.Println("err:::::444444", err) diff --git a/rule/one_circles/one_circles_deal_available_green_energy_points.go b/rule/one_circles/one_circles_deal_available_green_energy_points.go index 499a044..b2f3d0b 100644 --- a/rule/one_circles/one_circles_deal_available_green_energy_points.go +++ b/rule/one_circles/one_circles_deal_available_green_energy_points.go @@ -12,10 +12,11 @@ import ( "xorm.io/xorm" ) -func DealAvailableGreenEnergyCoin(session *xorm.Session, kind int, amount, amountFee float64, title string, chain *model.OneCirclesGreenEnergyBasicSetting, nowPriceValue string) error { +func DealAvailableGreenEnergyCoin(session *xorm.Session, kind int, amount, amountFee float64, title string, chain *model.OneCirclesGreenEnergyBasicSetting, nowPriceValue, masterId string) error { if chain == nil { // 查找 `one_circles_green_energy_basic_setting` 基础设置 - oneCirclesGreenEnergyBasicSetting, cb, err := svc.GetPrice(session.Engine(), nowPriceValue) + oneCirclesGreenEnergyBasicSetting, cb, err := svc.GetPrice(session.Engine(), masterId) + nowPriceValue = oneCirclesGreenEnergyBasicSetting.NowPrice if err != nil { return err } diff --git a/rule/one_circles/one_circles_sign_in_green_energy_settlement.go b/rule/one_circles/one_circles_sign_in_green_energy_settlement.go index 095183b..fc1d30f 100644 --- a/rule/one_circles/one_circles_sign_in_green_energy_settlement.go +++ b/rule/one_circles/one_circles_sign_in_green_energy_settlement.go @@ -8,7 +8,6 @@ import ( "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/rule" "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/rule/one_circles/enum" md2 "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/rule/one_circles/md" - "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/rule/one_circles/svc" zhios_order_relate_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/utils" zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/utils/logx" "encoding/json" @@ -74,13 +73,17 @@ func SettlementSignInGreenEnergy(engine *xorm.Engine, masterId string, ch *rabbi func HandleSettlementSignInGreenEnergy(ch *rabbit.Channel, engine *xorm.Engine, masterId string, id int64, uid int, endTime string) (err error) { //1、查找 `one_circles_green_energy_basic_setting` 基础设置 - oneCirclesGreenEnergyBasicSetting, cb, err := svc.GetPrice(engine, masterId) - if err != nil { - return - } - if cb != nil { - defer cb() // 释放锁 - } + oneCirclesGreenEnergyBasicSetting, err := db.OneCirclesGreenEnergyBasicSettingGetOneByParams(engine, map[string]interface{}{ + "key": "is_open", + "value": 1, + }) + //oneCirclesGreenEnergyBasicSetting, cb, err := svc.GetPrice(engine, masterId) + //if err != nil { + // return + //} + //if cb != nil { + // defer cb() // 释放锁 + //} var teamRewardSetting *md2.TeamRewardSettingStruct err = json.Unmarshal([]byte(oneCirclesGreenEnergyBasicSetting.TeamReward), &teamRewardSetting) @@ -194,7 +197,8 @@ func HandleSettlementSignInGreenEnergy(ch *rabbit.Channel, engine *xorm.Engine, //5、减少“活跃赠送” 中的绿色能量 if reduceTotalGreenEnergy > 0 { - err = DealAvailableGreenEnergyCoin(session, int(enum.SignInReward), reduceTotalGreenEnergy, 0, enum.SignInReward.String(), oneCirclesGreenEnergyBasicSetting, oneCirclesGreenEnergyBasicSetting.NowPrice) + //err = DealAvailableGreenEnergyCoin(session, int(enum.SignInReward), reduceTotalGreenEnergy, 0, enum.SignInReward.String(), oneCirclesGreenEnergyBasicSetting, oneCirclesGreenEnergyBasicSetting.NowPrice) + err = DealAvailableGreenEnergyCoin(session, int(enum.SignInReward), reduceTotalGreenEnergy, 0, enum.SignInReward.String(), nil, "", masterId) if err != nil { _ = session.Rollback() fmt.Println("err:::::55555", err) diff --git a/rule/one_circles/one_circles_star_level_dividends.go b/rule/one_circles/one_circles_star_level_dividends.go index 30c5318..0c059c0 100644 --- a/rule/one_circles/one_circles_star_level_dividends.go +++ b/rule/one_circles/one_circles_star_level_dividends.go @@ -288,7 +288,7 @@ func SettlementStarLevelDividends(engine *xorm.Engine, masterId string, ch *rabb //6、 减少“星级分红”中的绿色能量 totalDividend, _ := totalDividendValue.Float64() - err = DealAvailableGreenEnergyCoin(session, int(enum.SettlementStarLevelDividends), totalDividend, 0, enum.SettlementStarLevelDividends.String(), nil, masterId) + err = DealAvailableGreenEnergyCoin(session, int(enum.SettlementStarLevelDividends), totalDividend, 0, enum.SettlementStarLevelDividends.String(), nil, "", masterId) if err != nil { _ = session.Rollback() fmt.Println("err:::::9999999", err)