From d1bc94e4387aed4d6d55e434943d83b926cc5167 Mon Sep 17 00:00:00 2001 From: yulingwei <2436953959@qq.com> Date: Tue, 17 Dec 2019 18:30:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/StatisticsController.class.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Application/Admin/Controller/StatisticsController.class.php b/Application/Admin/Controller/StatisticsController.class.php index 4f972dcad..5a92958ba 100644 --- a/Application/Admin/Controller/StatisticsController.class.php +++ b/Application/Admin/Controller/StatisticsController.class.php @@ -1002,12 +1002,17 @@ if ($payids) { $end_time = $end_time > $end ? $end : $end_time; $map = " 1=1 "; + $game_map = ""; if (isset($_REQUEST['game_name'])) { - $map .= " AND game_id in (" . implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) . ")"; + $game_ids = implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')); + $map .= " AND game_id in ({$game_ids})"; + $game_map = " AND EXISTS (SELECT upi.user_id FROM tab_user_play_info as upi where upi.game_id in ({$game_ids}) AND upi.user_id = u.id "; + if (isset($_REQUEST['server_name'])) $game_map .= " AND upi.server_name = {$_REQUEST['server_name']} "; + $game_map .= ") "; } if (isset($_REQUEST['server_name'])) { $map .= " AND server_name = '{$_REQUEST['server_name']}' "; - } + } // 获取包含的用户id $users = M()->query(" SELECT @@ -1018,7 +1023,7 @@ if ($payids) { tab_user u WHERE u.register_time BETWEEN {$start_time} - AND {$end_time} + AND {$end_time} {$game_map} GROUP BY reg_date ORDER BY reg_date asc "); @@ -1037,7 +1042,7 @@ if ($payids) { ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 7).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_7, ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 14).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_14, ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 30).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_30, - SUM(if (pay_time BETWEEN {$start_time} and ".($end_time).", pay_amount, 0)) as total_amt + SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 30).", pay_amount, 0)) as total_amt FROM tab_spend WHERE