From 13541a96bea363b5dac36b821555d478c6a8b12a Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 18 Jul 2022 11:19:09 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E5=85=B1=E5=AF=8C=E5=88=B6=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- svc/public_platoon_relate_commission.go | 68 ++++++++++++------------- 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/svc/public_platoon_relate_commission.go b/svc/public_platoon_relate_commission.go index ea37d83..642f186 100644 --- a/svc/public_platoon_relate_commission.go +++ b/svc/public_platoon_relate_commission.go @@ -76,45 +76,43 @@ func BatchGetPublicPlatoonRelateCommissionByOrder(engine *xorm.Engine, masterId if userPublicPlatoonRelation == nil { return nil, errors.New("未查询到公排关系记录") } - fatherPositions := strings.Split(userPublicPlatoonRelation.FatherUid, "-") - var fatherPosition string - userPublicPlatoonRelation.ReturnCommissionNum++ - //if len(fatherPositions) < userPublicPlatoonSetting.SeveralRows { - remainder1 := (userPublicPlatoonRelation.ReturnCommissionNum) % len(fatherPositions) - if remainder1 == 0 { - fatherPosition = fatherPositions[len(fatherPositions)-1] + if userPublicPlatoonRelation.FatherUid == "" { + //TODO::原始创始人 + nowBenefitUid = "" } else { - fatherPosition = fatherPositions[remainder1-1] - } - //} else { - // remainder2 := (userPublicPlatoonRelation.ReturnCommissionNum) % userPublicPlatoonSetting.SeveralRows - // if remainder2 == 0 { - // fatherPosition = fatherPositions[userPublicPlatoonSetting.SeveralRows-1] - // } else { - // fatherPosition = fatherPositions[remainder2-1] - // } - //} + fatherPositions := strings.Split(userPublicPlatoonRelation.FatherUid, "-") + var fatherPosition string + userPublicPlatoonRelation.ReturnCommissionNum++ - nowBenefitUsers, err := db.UserPublicPlatoonRelationGetOneByParams(engine, map[string]interface{}{ - "key": "position", - "value": fatherPosition, - }) - if err != nil { - return nil, err - } - if nowBenefitUsers == nil { - return nil, errors.New("未查询到父级公排关系记录") - } - nowBenefitUid = zhios_order_relate_utils.AnyToString(nowBenefitUsers.Uid) + remainder1 := (userPublicPlatoonRelation.ReturnCommissionNum) % len(fatherPositions) + if remainder1 == 0 { + fatherPosition = fatherPositions[len(fatherPositions)-1] + } else { + fatherPosition = fatherPositions[remainder1-1] + } - //TODO::更新 公排关系记录 中 `return_commission_num` - affected, err := db.UserPublicPlatoonRelationUpdate(engine.NewSession(), userPublicPlatoonRelation.Id, userPublicPlatoonRelation, "return_commission_num") - if err != nil { - return nil, err - } - if affected == 0 { - return nil, errors.New("更新公排关系记录失败") + nowBenefitUsers, err := db.UserPublicPlatoonRelationGetOneByParams(engine, map[string]interface{}{ + "key": "position", + "value": fatherPosition, + }) + if err != nil { + return nil, err + } + if nowBenefitUsers == nil { + return nil, errors.New("未查询到父级公排关系记录") + } + nowBenefitUid = zhios_order_relate_utils.AnyToString(nowBenefitUsers.Uid) + + //TODO::更新 公排关系记录 中 `return_commission_num` + affected, err := db.UserPublicPlatoonRelationUpdate(engine.NewSession(), userPublicPlatoonRelation.Id, userPublicPlatoonRelation, "return_commission_num") + if err != nil { + return nil, err + } + if affected == 0 { + return nil, errors.New("更新公排关系记录失败") + } } + resp[param.Oid] = &md.PublicPlatoonRelateCommissionResp{ Uid: param.Uid, CommonWealthBenefitUid: nowBenefitUid,