From 6cb1ddbb12e7175ebc08482d231b63fb4ef9b251 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Wed, 31 Aug 2022 20:48:39 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E5=8C=BA=E5=9D=97=E6=98=9F=E9=93=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/db_block_star_chain_reward_records.go | 4 ++-- md/block_star_chain.go | 6 +++++- rule/block_star_chain_settlement.go | 6 ++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/db/db_block_star_chain_reward_records.go b/db/db_block_star_chain_reward_records.go index 93b8ff2..d6f505f 100644 --- a/db/db_block_star_chain_reward_records.go +++ b/db/db_block_star_chain_reward_records.go @@ -21,8 +21,8 @@ func BatchSelectBlockStarChainRewardRecords(Db *xorm.Engine, params map[string]i } // BlockStarChainRewardRecordsInsert 插入单条数据 -func BlockStarChainRewardRecordsInsert(Db *xorm.Engine, BlockStarChainRewardRecords *model.BlockStarChainRewardRecords) (int64, error) { - _, err := Db.InsertOne(BlockStarChainRewardRecords) +func BlockStarChainRewardRecordsInsert(session *xorm.Session, BlockStarChainRewardRecords *model.BlockStarChainRewardRecords) (int64, error) { + _, err := session.InsertOne(BlockStarChainRewardRecords) if err != nil { return 0, err } diff --git a/md/block_star_chain.go b/md/block_star_chain.go index b4e559f..3d12cb6 100644 --- a/md/block_star_chain.go +++ b/md/block_star_chain.go @@ -26,6 +26,8 @@ const ( OfflineConsumeGroupRewardByBusinessTitleForUserVirtualCoinFlow = "区块星链-线下消费团队奖励(商家)" OnlineConsumeDirectPushRewardTitleForUserVirtualCoinFlow = "区块星链-线上消费直推奖励" OnlineConsumeGroupRewardTitleForUserVirtualCoinFlow = "区块星链-线上消费团队奖励" + OfflineConsumeBeRewardTitleForUserVirtualCoinFlow = "区块星链-线下消费被打赏" + OfflineConsumeRewardTitleForUserVirtualCoinFlow = "区块星链-线下消费打赏" ) const ( @@ -43,7 +45,9 @@ const ( OfflineConsumeGroupRewardByUserTransferTypeForUserVirtualCoinFlow = 110 //区块星链-线下消费团队奖励(用户) OfflineConsumeGroupRewardByBusinessTransferTypeForUserVirtualCoinFlow = 111 //区块星链-线下消费团队奖励(商家) OnlineConsumeDirectPushRewardTransferTypeForUserVirtualCoinFlow = 111 //区块星链-线上消费直推奖励 - OnlineConsumeGroupRewardTypeForUserVirtualCoinFlow = 112 //区块星链-线上消费团队奖励 + OnlineConsumeGroupRewardTransferTypeForUserVirtualCoinFlow = 112 //区块星链-线上消费团队奖励 + OfflineConsumeBeRewardTransferTypeForUserVirtualCoinFlow = 113 //区块星链-线下消费被打赏 + OfflineConsumeRewardTransferTypeForUserVirtualCoinFlow = 114 //区块星链-线下消费打赏 ) const DealUserCoinRequestIdPrefix = "%s:block_star_chain_deal_user_coin:%d:uid:%d" diff --git a/rule/block_star_chain_settlement.go b/rule/block_star_chain_settlement.go index fb76f92..484e87b 100644 --- a/rule/block_star_chain_settlement.go +++ b/rule/block_star_chain_settlement.go @@ -144,6 +144,12 @@ func DailySettlementBlockStarChain(engine *xorm.Engine, mid string) (err error) _ = session.Rollback() return err } + + err = session.Commit() + if err != nil { + _ = session.Rollback() + return errors.New("事务提交失败") + } return nil }