From 36c240c608e173c87ed7b1b3c18719cd5083ed09 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Mon, 19 Oct 2020 17:58:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/GameApiController.class.php | 17 ++++++++++++++-- .../Service/TestingResourceService.class.php | 20 +++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/Application/Admin/Controller/GameApiController.class.php b/Application/Admin/Controller/GameApiController.class.php index 7bd30f474..e52bd0396 100644 --- a/Application/Admin/Controller/GameApiController.class.php +++ b/Application/Admin/Controller/GameApiController.class.php @@ -22,7 +22,13 @@ class GameApiController extends Think { public function verify() { $service = new TestingResourceService(); - $batches = M('testing_resource_batch', 'tab_')->where(['verify_status' => 0])->select(); + + $gameIds = $service->getHasItfGameIds(); + $map = ['verify_status' => 0]; + if (count($gameIds) > 0) { + $map['game_id'] = ['in', $gameIds]; + } + $batches = M('testing_resource_batch', 'tab_')->where($map)->select(); foreach ($batches as $batch) { $service->verify($batch); } @@ -31,7 +37,14 @@ class GameApiController extends Think { public function provide() { $service = new TestingResourceService(); - $batches = M('testing_resource_batch', 'tab_')->where(['verify_status' => 1, 'provide_status' => 0])->select(); + + $gameIds = $service->getHasItfGameIds(); + + $map = ['verify_status' => 1, 'provide_status' => 0]; + if (count($gameIds) > 0) { + $map['game_id'] = ['in', $gameIds]; + } + $batches = M('testing_resource_batch', 'tab_')->where($map)->select(); foreach ($batches as $batch) { $service->provide($batch); } diff --git a/Application/Base/Service/TestingResourceService.class.php b/Application/Base/Service/TestingResourceService.class.php index 15b33344e..bb9aea68a 100644 --- a/Application/Base/Service/TestingResourceService.class.php +++ b/Application/Base/Service/TestingResourceService.class.php @@ -555,4 +555,24 @@ class TestingResourceService } return $resources; } + + public function getHasItfGameIds() + { + $gameSettings = $this->repository->getGameSettings(); + $baseGameIds = []; + foreach ($gameSettings as $gameSetting) { + if ($gameSetting['has_itf'] == 1) { + $baseGameIds[] = $gameSetting['base_game_id']; + } + } + $baseGames = []; + if (count($baseGameIds) > 0) { + $baseGames = M('base_game', 'tab_')->where(['id' => ['in', $baseGameIds]])->select(); + } + if (empty($baseGames)) { + return []; + } else { + return array_merge(array_column($baseGames, 'android_game_id'), array_column($baseGames, 'ios_game_id')); + } + } } \ No newline at end of file