master
ELF 4 years ago
parent ae3e49b95f
commit 36c240c608

@ -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);
}

@ -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'));
}
}
}
Loading…
Cancel
Save