From 916710ca48ae6df4812dbb325bec9068f3171656 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sat, 9 Nov 2024 12:22:33 +0800 Subject: [PATCH] 1 --- webapp/services/CircuitRankingService.php | 28 ++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/webapp/services/CircuitRankingService.php b/webapp/services/CircuitRankingService.php index 7c7f6038..f02f12a7 100644 --- a/webapp/services/CircuitRankingService.php +++ b/webapp/services/CircuitRankingService.php @@ -174,7 +174,33 @@ class CircuitRankingService extends BaseService { public static function recalcRanking() { - + $currentStageMeta = mt\CircuitTime::getCurrentStage(); + if (empty($currentStageMeta)) { + myself()->_rspErr(1, 'currentStageMeta Is empty'); + return; + } + $rows = SqlHelper::ormSelect + ($this->_getMysql(''), + 't_circuit_battle_phase', + array( + 'season' => $currentStageMeta['circuit_season'], + 'phase' => $currentStageMeta['circuit_phase'], + 'is_android' => 0, + ) + ); + $data = array(); + foreach ($rows as $row) { + if ($row['cumulative_scor'] > 0) { + array_push($data, $row); + } + } + $sortRows = myself()->arraySort($data, 'cumulative_score', 'desc'); + if (count($sortRows) <= 20) { + myself()->_rspErr(1, '人数不足20'); + return; + } + //21-100 之间的名次 塞入35名 + //101-200之间的名次 塞入 40名 } }