From 292d64b4b35c395f7ed6918922b1332a8add9db2 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 5 Feb 2024 18:24:40 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=B8=80=E4=B8=AA=E5=9C=88=E5=9C=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ic_platoon_double_network_relate_commission.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/rule/public_platoon_double_network_relate_commission.go b/rule/public_platoon_double_network_relate_commission.go index 391e6cc..159c152 100644 --- a/rule/public_platoon_double_network_relate_commission.go +++ b/rule/public_platoon_double_network_relate_commission.go @@ -192,6 +192,19 @@ func makeSearchLevelDoubleNetwork(position *int, rows float64, times *float64) ( } } +//递归查找等级 +func makeSearchLevelDoubleNetworkByPosition(position *int, rows float64, times *float64) (level int) { + for { + level++ + positionStart := getLevelForFirstPositionDoubleNetwork(level, int(*times)) + positionEnd := getLevelForLastPositionDoubleNetwork(level, int(*times)) + if positionStart <= *position && *position <= positionEnd { + break + } + } + return +} + //查找归属父级id func makeSearchPidDoubleNetwork(position int, row int) (pid int) { divisionValue := (position - 1) / row @@ -373,7 +386,7 @@ func EstimateUserPosition(engine *xorm.Engine, uid int) (total, level, levelRank } rows := float64(userPublicPlatoonDoubleNetworkSetting.SeveralRows) times := float64(userPublicPlatoonDoubleNetworkSetting.SeveralTimes) - level = makeSearchLevelDoubleNetwork(&rank, rows, ×) + level = makeSearchLevelDoubleNetworkByPosition(&rank, rows, ×) levelPosition1 := getLevelForFirstPositionDoubleNetwork(level, userPublicPlatoonDoubleNetworkSetting.SeveralTimes) levelRank = rank - levelPosition1 + 1