From 604bc5d706a40474b79ef8891b2d9bc47dd8edaf Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Tue, 29 Nov 2022 16:41:11 +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 --- rule/integral_release_settlement.go | 35 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/rule/integral_release_settlement.go b/rule/integral_release_settlement.go index f9fcf47..fce41ba 100644 --- a/rule/integral_release_settlement.go +++ b/rule/integral_release_settlement.go @@ -207,11 +207,8 @@ func DailySettlementIntegralReleaseForInterposition(engine *xorm.Engine, mid str } for _, user := range users { //查询当前用户今日的积分释放值 - var integralReleaseUserWithOrdFlow model.IntegralReleaseUserWithOrdFlow - has, err := session.Where("uid =? and release_date =?", user.Uid, today).And("release_green_coin_num > 0").Desc("id").Get(&integralReleaseUserWithOrdFlow) - if has == false { - continue - } + var integralReleaseUserWithOrdFlows []model.IntegralReleaseUserWithOrdFlow + err := session.Where("uid =? and release_date =?", user.Uid, 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, @@ -219,21 +216,23 @@ func DailySettlementIntegralReleaseForInterposition(engine *xorm.Engine, mid str "err": err, })) } - if zhios_order_relate_utils.StrToFloat64(integralReleaseUserWithOrdFlow.ReleaseGreenCoinNum) <= 0 { + if len(integralReleaseUserWithOrdFlows) == 0 { continue } - //发放服务收益 - err = DealIntegralReleaseInterpositionUserAmount(session, md.DealIntegralReleaseInterpositionUserAmountReq{ - Kind: "sub", - Mid: mid, - OrdId: "", - CoinId: user.CoinId, - Uid: user.Uid, - Amount: zhios_order_relate_utils.StrToFloat64(integralReleaseUserWithOrdFlow.ReleaseGreenCoinNum), - }) - if err != nil { - _ = session.Rollback() - return err + 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), + }) + if err != nil { + _ = session.Rollback() + return err + } } }