From 626a536a3441508e5bdd34d2d129aff4984e8d6f Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Tue, 29 Nov 2022 16:54:45 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=B8=AD=E5=9F=BA=E7=A7=AF=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...egral_release_interposition_user_amount.go | 1 + md/fin_user_flow.go | 13 +++++----- rule/integral_release_settlement.go | 24 ++++++++++--------- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/db/model/integral_release_interposition_user_amount.go b/db/model/integral_release_interposition_user_amount.go index 2c8329d..0438c41 100644 --- a/db/model/integral_release_interposition_user_amount.go +++ b/db/model/integral_release_interposition_user_amount.go @@ -7,6 +7,7 @@ import ( type IntegralReleaseInterpositionUserAmount struct { Id int `json:"id" xorm:"not null pk autoincr comment('主键id') INT(11)"` Uid int `json:"uid" xorm:"not null default 0 comment('用户uid') INT(11)"` + OriginalUid int `json:"original_uid" xorm:"not null default 0 comment('原始用户uid') INT(11)"` CoinId int `json:"coin_id" xorm:"not null default 0 comment('虚拟币id(若为0则为 余额)') INT(11)"` TotalAmount string `json:"total_amount" xorm:"not null default 0.0000 comment('累计金额') DECIMAL(10,4)"` WaiteAmount string `json:"waite_amount" xorm:"not null default 0.0000 comment('待释放金额') DECIMAL(10,4)"` diff --git a/md/fin_user_flow.go b/md/fin_user_flow.go index adebd63..21f5dc2 100644 --- a/md/fin_user_flow.go +++ b/md/fin_user_flow.go @@ -24,12 +24,13 @@ const DealUserAmountRequestIdPrefix = "%s:deal_user_amount:%d" const UserAmountRedisKey = "%s:user_amount:%d" type DealIntegralReleaseInterpositionUserAmountReq struct { - Kind string `json:"kind"` - Mid string `json:"mid"` - OrdId string `json:"ord_id"` - CoinId int `json:"coin_id"` - Uid int `json:"uid"` - Amount float64 `json:"amount"` + Kind string `json:"kind"` + Mid string `json:"mid"` + OrdId string `json:"ord_id"` + CoinId int `json:"coin_id"` + Uid int `json:"uid"` + OriginalUid int `json:"original_uid"` + Amount float64 `json:"amount"` } type DealUserAmount struct { diff --git a/rule/integral_release_settlement.go b/rule/integral_release_settlement.go index fce41ba..d0854d3 100644 --- a/rule/integral_release_settlement.go +++ b/rule/integral_release_settlement.go @@ -208,7 +208,7 @@ func DailySettlementIntegralReleaseForInterposition(engine *xorm.Engine, mid str for _, user := range users { //查询当前用户今日的积分释放值 var integralReleaseUserWithOrdFlows []model.IntegralReleaseUserWithOrdFlow - err := session.Where("uid =? and release_date =?", user.Uid, today).And("release_green_coin_num > 0").Find(&integralReleaseUserWithOrdFlows) + err := session.Where("uid =? and release_date =?", user.OriginalUid, today).And("release_green_coin_num > 0").Find(&integralReleaseUserWithOrdFlows) if err != nil { zhios_order_relate_utils.FilePutContents("find_integral_release_user_with_ord_flow_err", zhios_order_relate_utils.SerializeStr(map[string]interface{}{ "uid": user.Uid, @@ -222,12 +222,13 @@ func DailySettlementIntegralReleaseForInterposition(engine *xorm.Engine, mid str for _, integralReleaseUserWithOrdFlow := range integralReleaseUserWithOrdFlows { //发放服务收益 err = DealIntegralReleaseInterpositionUserAmount(session, md.DealIntegralReleaseInterpositionUserAmountReq{ - Kind: "sub", - Mid: mid, - OrdId: "", - CoinId: 0, //TODO::直接写死为0,返现金 - Uid: user.Uid, //TODO::待替换成间推用户uid - Amount: zhios_order_relate_utils.StrToFloat64(integralReleaseUserWithOrdFlow.ReleaseGreenCoinNum), + Kind: "sub", + Mid: mid, + OrdId: "", + CoinId: 0, //TODO::直接写死为0,返现金 + Uid: user.Uid, //TODO::替换成间推用户uid + OriginalUid: user.OriginalUid, + Amount: zhios_order_relate_utils.StrToFloat64(integralReleaseUserWithOrdFlow.ReleaseGreenCoinNum), }) if err != nil { _ = session.Rollback() @@ -432,10 +433,11 @@ func DealIntegralReleaseInterpositionUserAmount(session *xorm.Session, req md.De }) if err != nil && err.Error() == "not found" { userAmount = &model.IntegralReleaseInterpositionUserAmount{ - Uid: req.Uid, - CoinId: req.CoinId, - CreateAt: now, - UpdateAt: now, + Uid: req.Uid, + OriginalUid: req.OriginalUid, + CoinId: req.CoinId, + CreateAt: now, + UpdateAt: now, } _, err = db.IntegralReleaseInterpositionUserAmountInsert(session, userAmount) }