diff --git a/Application/Home/Controller/ApplyController.class.php b/Application/Home/Controller/ApplyController.class.php index 18b02e1b3..8ac5b2ad0 100644 --- a/Application/Home/Controller/ApplyController.class.php +++ b/Application/Home/Controller/ApplyController.class.php @@ -1622,15 +1622,19 @@ class ApplyController extends BaseController $gameData['sdk_name'] = getSDKTypeName($gameData['sdk_version']); - $promoteIds = getAllPromoteListByType($promoteType); + $promotes = getAllPromoteListByType($promoteType); - $newPromoteData = []; - if (count($promoteIds) > 0) { - foreach ($promoteIds as $value) { - $thisPromote = M('apply', 'tab_')->where(array('game_id' => $gameId, 'promote_id' => $value['id'], 'offline_status' => 0))->count('id'); + M('apply', 'tab_')->where(array('game_id' => $gameId, 'promote_id' => $value['id'], 'offline_status' => 0))->count('id'); - if (!$thisPromote) { - $newPromoteData[] = $value; + $newPromoteData = []; + if (count($promotes) > 0) { + + $promoteIds = array_column($promotes, 'id'); + $oldIds = M('apply', 'tab_')->where(['game_id' => $gameId, 'promote_id' => ['in', $promoteIds], 'offline_status' => 0])->getField('id', true); + $newPromoteIds = array_diff($promoteIds, $oldIds); + foreach ($promotes as $promote) { + if (in_array($promote['id'], $newPromoteIds)) { + $newPromoteData[] = $promote; } } }