@@ -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 { | if err != nil { | ||||
fmt.Println("err:::::22222", err) | fmt.Println("err:::::22222", err) | ||||
_ = session.Rollback() | _ = session.Rollback() | ||||
@@ -78,7 +78,7 @@ func AutoAdjustPrice(engine *xorm.Engine, masterId string) (err error) { | |||||
return err1 | 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 { | if err != nil { | ||||
fmt.Println("err:::::44444", err) | fmt.Println("err:::::44444", err) | ||||
_ = session.Rollback() | _ = session.Rollback() | ||||
@@ -84,7 +84,7 @@ func CommunityDividends(engine *xorm.Engine, masterId string) (err error) { | |||||
} | } | ||||
//6、 减少“社区分红”钱包中的值 | //6、 减少“社区分红”钱包中的值 | ||||
totalDividend, _ := totalValue.Float64() | 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 { | if err != nil { | ||||
_ = session.Rollback() | _ = session.Rollback() | ||||
fmt.Println("err:::::444444", err) | fmt.Println("err:::::444444", err) | ||||
@@ -12,10 +12,11 @@ import ( | |||||
"xorm.io/xorm" | "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 { | if chain == nil { | ||||
// 查找 `one_circles_green_energy_basic_setting` 基础设置 | // 查找 `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 { | if err != nil { | ||||
return err | return err | ||||
} | } | ||||
@@ -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" | ||||
"code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/rule/one_circles/enum" | "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" | 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_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" | zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/utils/logx" | ||||
"encoding/json" | "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) { | 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` 基础设置 | //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 | var teamRewardSetting *md2.TeamRewardSettingStruct | ||||
err = json.Unmarshal([]byte(oneCirclesGreenEnergyBasicSetting.TeamReward), &teamRewardSetting) | err = json.Unmarshal([]byte(oneCirclesGreenEnergyBasicSetting.TeamReward), &teamRewardSetting) | ||||
@@ -194,7 +197,8 @@ func HandleSettlementSignInGreenEnergy(ch *rabbit.Channel, engine *xorm.Engine, | |||||
//5、减少“活跃赠送” 中的绿色能量 | //5、减少“活跃赠送” 中的绿色能量 | ||||
if reduceTotalGreenEnergy > 0 { | 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 { | if err != nil { | ||||
_ = session.Rollback() | _ = session.Rollback() | ||||
fmt.Println("err:::::55555", err) | fmt.Println("err:::::55555", err) | ||||
@@ -288,7 +288,7 @@ func SettlementStarLevelDividends(engine *xorm.Engine, masterId string, ch *rabb | |||||
//6、 减少“星级分红”中的绿色能量 | //6、 减少“星级分红”中的绿色能量 | ||||
totalDividend, _ := totalDividendValue.Float64() | 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 { | if err != nil { | ||||
_ = session.Rollback() | _ = session.Rollback() | ||||
fmt.Println("err:::::9999999", err) | fmt.Println("err:::::9999999", err) | ||||