From 8136bff2f9723455e8825626d79d99468077458c Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Mon, 20 Jan 2020 13:54:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/Controller/ApplyController.class.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) 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; } } }