From a84757c8b96ea719d7281d609cd5553f836a4116 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Thu, 24 Nov 2022 09:43:11 +0800 Subject: [PATCH] =?UTF-8?q?add=20reverse:for=20v4.0.4=20=E7=A7=AF=E5=88=86?= =?UTF-8?q?=E9=87=8A=E6=94=BE=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- md/block_star_chain.go | 28 ++++++++++++++++------------ rule/integral_release_settlement.go | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/md/block_star_chain.go b/md/block_star_chain.go index 9cf3520..75ca59c 100644 --- a/md/block_star_chain.go +++ b/md/block_star_chain.go @@ -42,12 +42,14 @@ const ( BlockGreenChainTransactionAndDestroyTitleForUserVirtualCoinFlow = "绿色积分-交易(销毁贡献值)" BlockGreenChainAdminDestroyTitleForUserVirtualCoinFlow = "绿色积分-管理员销毁" - IntegralReleaseRedCoinGrantByOrdTitleForUserVirtualCoinFlow = "积分释放-红积分发放(订单)" - IntegralReleaseRedCoinGrantBySignInTitleForUserVirtualCoinFlow = "积分释放-红积分发放(签到)" - IntegralReleaseRedCoinGrantByRefundForUserVirtualCoinFlow = "订单退款-红积分扣除" - IntegralReleaseGreenCoinGrantByRefundForUserVirtualCoinFlow = "订单退款-绿积分扣除" - IntegralReleaseGreenCoinGrantByOrdTitleForUserVirtualCoinFlow = "积分释放-绿积分发放(订单)" - IntegralReleaseGreenCoinGrantBySignInTitleForUserVirtualCoinFlow = "积分释放-绿积分发放(签到)" + IntegralReleaseRedCoinGrantByOrdTitleForUserVirtualCoinFlow = "积分释放-红积分发放(订单)" + IntegralReleaseRedCoinGrantBySignInTitleForUserVirtualCoinFlow = "积分释放-红积分发放(签到)" + IntegralReleaseRedCoinGrantByOrdTitleDeductForUserVirtualCoinFlow = "积分释放-红积分扣除(订单)" + IntegralReleaseRedCoinGrantBySignInTitleDeductForUserVirtualCoinFlow = "积分释放-红积分扣除(签到)" + IntegralReleaseRedCoinGrantByRefundForUserVirtualCoinFlow = "订单退款-红积分扣除" + IntegralReleaseGreenCoinGrantByRefundForUserVirtualCoinFlow = "订单退款-绿积分扣除" + IntegralReleaseGreenCoinGrantByOrdTitleForUserVirtualCoinFlow = "积分释放-绿积分发放(订单)" + IntegralReleaseGreenCoinGrantBySignInTitleForUserVirtualCoinFlow = "积分释放-绿积分发放(签到)" ) const ( @@ -82,12 +84,14 @@ const ( BlockGreenChainTransactionAndDestroyTransferTypeForUserVirtualCoinFlow = 133 // 绿色积分-交易(销毁贡献值) BlockGreenChainAdminDestroyTransferTypeForUserVirtualCoinFlow = 134 // 绿色积分-管理员销毁 - IntegralReleaseRedCoinGrantByOrdTransferTypeForUserVirtualCoinFlow = 135 // 积分释放-红积分发放(订单) - IntegralReleaseRedCoinGrantBySignInTransferTypeForUserVirtualCoinFlow = 136 // 积分释放-红积分发放(签到) - IntegralReleaseGreenCoinGrantByOrdTransferTypeForUserVirtualCoinFlow = 137 // 积分释放-绿积分发放(订单) - IntegralReleaseGreenCoinGrantBySignInTransferTypeForUserVirtualCoinFlow = 138 // 积分释放-绿积分发放(签到) - IntegralReleaseRedCoinGrantByOrdRefundTypeForUserVirtualCoinFlow = 139 // 订单退款-红积分扣除 - IntegralReleaseGreenCoinGrantByOrdRefundTypeForUserVirtualCoinFlow = 140 // 订单退款-绿积分扣除 + IntegralReleaseRedCoinGrantByOrdTransferTypeForUserVirtualCoinFlow = 135 // 积分释放-红积分发放(订单) + IntegralReleaseRedCoinGrantBySignInTransferTypeForUserVirtualCoinFlow = 136 // 积分释放-红积分发放(签到) + IntegralReleaseGreenCoinGrantByOrdTransferTypeForUserVirtualCoinFlow = 137 // 积分释放-绿积分发放(订单) + IntegralReleaseGreenCoinGrantBySignInTransferTypeForUserVirtualCoinFlow = 138 // 积分释放-绿积分发放(签到) + IntegralReleaseRedCoinGrantByOrdRefundTypeForUserVirtualCoinFlow = 139 // 订单退款-红积分扣除 + IntegralReleaseGreenCoinGrantByOrdRefundTypeForUserVirtualCoinFlow = 140 // 订单退款-绿积分扣除 + IntegralReleaseRedCoinGrantByOrdTransferTypeDeductForUserVirtualCoinFlow = 141 // 积分释放-红积分发放(订单) + IntegralReleaseRedCoinGrantBySignInTransferTypeDeductForUserVirtualCoinFlow = 142 // 积分释放-红积分发放(签到) ) diff --git a/rule/integral_release_settlement.go b/rule/integral_release_settlement.go index b1e0e0a..3c017b0 100644 --- a/rule/integral_release_settlement.go +++ b/rule/integral_release_settlement.go @@ -234,9 +234,13 @@ func ReleaseGreenCoinForUser(session *xorm.Session, mid string, integralReleaseB //2、释放绿积分 var title = md.IntegralReleaseGreenCoinGrantByOrdTitleForUserVirtualCoinFlow var transferType = md.IntegralReleaseGreenCoinGrantByOrdTransferTypeForUserVirtualCoinFlow + var titleRed = md.IntegralReleaseRedCoinGrantByOrdTitleDeductForUserVirtualCoinFlow + var transferTypeRed = md.IntegralReleaseRedCoinGrantByOrdTransferTypeDeductForUserVirtualCoinFlow if integralReleaseUserWithOrd.Pvd == 0 { title = md.IntegralReleaseGreenCoinGrantBySignInTitleForUserVirtualCoinFlow transferType = md.IntegralReleaseGreenCoinGrantBySignInTransferTypeForUserVirtualCoinFlow + titleRed = md.IntegralReleaseRedCoinGrantBySignInTitleDeductForUserVirtualCoinFlow + transferTypeRed = md.IntegralReleaseRedCoinGrantBySignInTransferTypeDeductForUserVirtualCoinFlow } err := DealUserCoinForIntegralRelease(session, md.DealUserCoinReq{ Kind: "add", @@ -251,6 +255,20 @@ func ReleaseGreenCoinForUser(session *xorm.Session, mid string, integralReleaseB if err != nil { return err } + //扣除红积分 + err = DealUserCoinForIntegralRelease(session, md.DealUserCoinReq{ + Kind: "sub", + Mid: mid, + Title: titleRed, + TransferType: transferTypeRed, + OrdId: integralReleaseUserWithOrd.OrdId, + CoinId: integralReleaseBasic.Coin1, + Uid: integralReleaseUserWithOrd.Uid, + Amount: zhios_order_relate_utils.StrToFloat64(releaseCoinNum.String()), + }) + if err != nil { + return err + } releasedGreenCoinNumBefore, _ := decimal.NewFromString(integralReleaseUserWithOrd.ReleasedGreenCoinNum) releasedGreenCoinNumAfter := releasedGreenCoinNumBefore.Add(releaseCoinNum)