From 41ac53f3a573ee4d7a7c6ce3aae1eea5c139c894 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Wed, 13 Jul 2022 20:23:23 +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 | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/svc/public_platoon_relate_commission.go b/svc/public_platoon_relate_commission.go index 9a80170..8c365e6 100644 --- a/svc/public_platoon_relate_commission.go +++ b/svc/public_platoon_relate_commission.go @@ -79,12 +79,22 @@ func BatchGetPublicPlatoonRelateCommissionByOrder(engine *xorm.Engine, masterId fatherPositions := strings.Split(userPublicPlatoonRelation.FatherUid, "-") var fatherPosition string userPublicPlatoonRelation.ReturnCommissionNum++ - remainder := (userPublicPlatoonRelation.ReturnCommissionNum) % userPublicPlatoonSetting.SeveralRows - if remainder == 0 { - fatherPosition = fatherPositions[userPublicPlatoonSetting.SeveralRows-1] + if len(fatherPositions) < userPublicPlatoonSetting.SeveralRows { + remainder1 := (userPublicPlatoonRelation.ReturnCommissionNum) % len(fatherPositions) + if remainder1 == 0 { + fatherPosition = fatherPositions[len(fatherPositions)-1] + } else { + fatherPosition = fatherPositions[len(fatherPositions)-remainder1] + } } else { - fatherPosition = fatherPositions[remainder-1] + remainder2 := (userPublicPlatoonRelation.ReturnCommissionNum) % userPublicPlatoonSetting.SeveralRows + if remainder2 == 0 { + fatherPosition = fatherPositions[userPublicPlatoonSetting.SeveralRows-1] + } else { + fatherPosition = fatherPositions[remainder2-1] + } } + nowBenefitUsers, err := db.UserPublicPlatoonRelationGetOneByParams(engine, map[string]interface{}{ "key": "position", "value": fatherPosition,