diff --git a/webapp/services/CircuitRankingService.php b/webapp/services/CircuitRankingService.php index e2f3d115..fadc7ad1 100644 --- a/webapp/services/CircuitRankingService.php +++ b/webapp/services/CircuitRankingService.php @@ -33,6 +33,7 @@ class CircuitRankingService extends BaseService { foreach ($rows as $row) { $androidHash[$row['account_id']] = $row; } + $androidHashDb = self::getAndroidHashDb($androidHash); if (count($androidHash) < 100) { for ($i = count($androidHash); $i < 100; $i++) { @@ -40,6 +41,24 @@ class CircuitRankingService extends BaseService { } } + public static function getAndroidHashDb($alreadyAndroidHash) + { + $androidHash = array(); + $rows = SqlHelper::ormSelectOne + ($this->_getMysql(''), + 't_android', + array( + 'used' => 0 + ) + ); + foreach ($rows as $row) { + if (!array_key_exists($row['robot_id'], $alreadyAndroidHash)) { + $androidHash[$row['robot_id']] = $row; + } + } + return $androidHash; + } + public static function repairRanking($currentCircuitMeta) { $rows = myself()->_callModelStatic('Circuit', 'getCircuitList',