From 0ee7c7c7904328862d4accc36bf6325474b68895 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Wed, 24 Apr 2024 19:33:13 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E8=AE=A1=E7=AE=97=E8=A7=82=E7=9C=8B?= =?UTF-8?q?=E6=BF=80=E5=8A=B1=E8=A7=86=E5=B1=8F=E5=BE=97=E5=88=B0=E6=B4=BB?= =?UTF-8?q?=E8=B7=83=E7=A7=AF=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- md/mq.go | 9 +++--- rule/one_circles/coin_settlement.go | 3 -- ...ircles_public_platoon_give_activty_coin.go | 29 ++++++++++++++----- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/md/mq.go b/md/mq.go index ca73399..c1934aa 100644 --- a/md/mq.go +++ b/md/mq.go @@ -3,10 +3,11 @@ package md const OneCirclesExchange = "one.circles" const ( - OneCirclesRoutKeyForSignIn = "sign_in" // 签到 - OneCirclesRoutKeyForStarLevelDividend = "star_level_dividend" // 星级分红 - OneCirclesRoutKeyForAutoExchangeGreenEnergyToPerson = "auto_exchange_green_energy_to_person" // 自动兑换个人绿色能量 - OneCirclesRoutKeyForAutoExchangeGreenEnergyToTeam = "auto_exchange_green_energy_to_team" // 自动兑换团队绿色能量 + OneCirclesRoutKeyForSignIn = "sign_in" // 签到 + OneCirclesRoutKeyForStarLevelDividend = "star_level_dividend" // 星级分红 + OneCirclesRoutKeyForAutoExchangeGreenEnergyToPerson = "auto_exchange_green_energy_to_person" // 自动兑换个人绿色能量 + OneCirclesRoutKeyForAutoExchangeGreenEnergyToTeam = "auto_exchange_green_energy_to_team" // 自动兑换团队绿色能量 + OneCirclesRoutKeyForSettlementPublicGiveActivityCoin = "settlement_public_give_activity_coin" // 计算观看激励视屏得到活跃积分 ) type OneCirclesStructForSignIn struct { diff --git a/rule/one_circles/coin_settlement.go b/rule/one_circles/coin_settlement.go index 2a6c6c6..636b099 100644 --- a/rule/one_circles/coin_settlement.go +++ b/rule/one_circles/coin_settlement.go @@ -15,9 +15,6 @@ import ( "xorm.io/xorm" ) -const PessimismLockKey = "daily_settlement_block_star_chain_pessimism_lock_key" -const PessimismLockValue = "running" - // DealUserCoin 处理给用户虚拟币积分 func DealUserCoin(session *xorm.Session, req md.DealUserCoinReq) (err error) { if req.Amount < 0 { diff --git a/rule/one_circles/one_circles_public_platoon_give_activty_coin.go b/rule/one_circles/one_circles_public_platoon_give_activty_coin.go index 4af3958..f4fbbe3 100644 --- a/rule/one_circles/one_circles_public_platoon_give_activty_coin.go +++ b/rule/one_circles/one_circles_public_platoon_give_activty_coin.go @@ -1,6 +1,7 @@ package one_circles import ( + "code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit" "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/db" "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/db/model" "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/md" @@ -17,7 +18,7 @@ import ( ) // SettlementPublicGiveActivityCoin 计算观看激励视屏得到活跃积分 -func SettlementPublicGiveActivityCoin(engine *xorm.Engine, masterId string, uid int) (err error) { +func SettlementPublicGiveActivityCoin(engine *xorm.Engine, masterId string, uid int, ch *rabbit.Channel) (err error) { //1、查找 `one_circles_public_platoon_basic_setting` 基础设置 oneCirclesPublicPlatoonBasicSetting, err := db.OneCirclesPublicPlatoonBasicSettingGetOneByParams(engine, map[string]interface{}{ "key": "is_open", @@ -182,7 +183,8 @@ func SettlementPublicGiveActivityCoin(engine *xorm.Engine, masterId string, uid //给相应的用户加上"团队"活跃积分 for _, vv := range rewardFather { - err = DealUserCoin(session, md.DealUserCoinReq{ + //TODO::推入rabbitmq 异步处理 + ch.Publish(md.OneCirclesExchange, md.DealUserCoinReq{ Kind: "add", Mid: masterId, Title: md.OneCirclesWatchAdRewardTeamActiveCoin, @@ -191,12 +193,23 @@ func SettlementPublicGiveActivityCoin(engine *xorm.Engine, masterId string, uid CoinId: oneCirclesPublicPlatoonBasicSetting.TeamActivePointsCoinId, Uid: vv.Uid, Amount: vv.RewardValue, - }) - if err != nil { - _ = session.Rollback() - fmt.Println("err:::::2222", err) - return err - } + }, md.OneCirclesRoutKeyForSettlementPublicGiveActivityCoin) + + //err = DealUserCoin(session, md.DealUserCoinReq{ + // Kind: "add", + // Mid: masterId, + // Title: md.OneCirclesWatchAdRewardTeamActiveCoin, + // TransferType: md.OneCirclesWatchAdRewardTeamActiveCoinForUserVirtualCoinFlow, + // OrdId: "", + // CoinId: oneCirclesPublicPlatoonBasicSetting.TeamActivePointsCoinId, + // Uid: vv.Uid, + // Amount: vv.RewardValue, + //}) + //if err != nil { + // _ = session.Rollback() + // fmt.Println("err:::::2222", err) + // return err + //} } err = session.Commit() if err != nil {