优化查询

master
ELF 5 years ago
parent 6993d164a3
commit 8136bff2f9

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

Loading…
Cancel
Save