From 68df391d9c56790f6e6170fc1981bd40abbf3cb6 Mon Sep 17 00:00:00 2001 From: jbrazz <2436953959@qq.com> Date: Tue, 5 Nov 2019 20:14:28 +0800 Subject: [PATCH] upt --- .../Controller/PlatformController.class.php | 79 +++++++------------ .../Admin/Controller/access_data_foldline.txt | 2 +- .../View/Platform/promote_statistics.html | 9 ++- .../View/Platform/promotepay_statistics.html | 2 +- 4 files changed, 37 insertions(+), 55 deletions(-) diff --git a/Application/Admin/Controller/PlatformController.class.php b/Application/Admin/Controller/PlatformController.class.php index e7e8c0ea9..9d34117b5 100644 --- a/Application/Admin/Controller/PlatformController.class.php +++ b/Application/Admin/Controller/PlatformController.class.php @@ -340,8 +340,8 @@ class PlatformController extends ThinkController } $user = M('User', 'tab_'); - $map['promote_id'] = array('egt', 0); - $map['puid'] = 0; + // $map['promote_id'] = array('egt', 0); + // $map['puid'] = 0; if (!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) { $map['register_time'] = ['between', array(strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399)]; unset($_REQUEST['timestart']); @@ -353,61 +353,42 @@ class PlatformController extends ThinkController $map['register_time'] = ['elt', strtotime($_REQUEST['timeend']) + 86399]; unset($_REQUEST['timeend']); } + $play_info_map = ''; if (isset($_REQUEST['game_name'])) { $map['fgame_name'] = $_REQUEST['game_name']; + $play_info_map .= " and upi.game_name = '{$_REQUEST['game_name']}' "; unset($_REQUEST['game_name']); } $today = total(1); $week = total(2); $mounth = total(3); - if (isset($_REQUEST['server_id'])) { - $map['server_name'] = $_REQUEST['server_id']; - $map['game_name'] = $map['fgame_name']; - $map['u.promote_id'] = $map['promote_id']; - unset($map['promote_id']); - unset($map['fgame_name']); - unset($_REQUEST['server_id']); - - if (isset($_REQUEST['promote_id'])) { - $map['_string'] = "u.promote_id = {$_REQUEST['promote_id']} or tab_promote.parent_id = {$_REQUEST['promote_id']} or tab_promote.grand_id = {$_REQUEST['promote_id']} "; - unset($_REQUEST['promote_id']); - } - $data = M('user_play_info', 'tab_')->alias('u') - ->field('u.promote_account,u.promote_id,date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time, count(u.user_id) as count, - IF(tab_promote.grand_id>0,tab_promote.grand_id,IF(tab_promote.grand_id=0 and tab_promote.parent_id >0,tab_promote.parent_id,u.promote_id)) as promote_id1 , - count(IF(register_time ' . $today . ',1,null)) as today, - count(IF(register_time ' . $week . ',1,null)) as week, - count(IF(register_time ' . $mounth . ',1,null)) as mounth') - ->join('tab_user on tab_user.id = u.user_id') - ->join('tab_promote on u.promote_id = tab_promote.id', 'left') - ->where($map) - ->group('promote_id1') -// ->having('u.promote_id != 0') - ->order('count desc,register_time') - ->select(); + if (isset($_REQUEST['promote_id'])) { + $map['tp1.id'] = $_REQUEST['promote_id']; } else { - if (isset($_REQUEST['promote_id'])) { - - $map['_string'] = "promote_id = {$_REQUEST['promote_id']} or tab_promote.parent_id = {$_REQUEST['promote_id']} or tab_promote.grand_id = {$_REQUEST['promote_id']} "; - unset($_REQUEST['promote_id']); - } + $map['tp1.chain'] = '/'; + } - $data = $user - ->field('promote_account,promote_id,date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time, count(tab_user.id) as count, - IF(tab_promote.grand_id>0,tab_promote.grand_id,IF(tab_promote.grand_id=0 and tab_promote.parent_id >0,tab_promote.parent_id,promote_id)) as promote_id1 , - count(IF(register_time ' . $today . ',1,null)) as today, - count(IF(register_time ' . $week . ',1,null)) as week, - count(IF(register_time ' . $mounth . ',1,null)) as mounth') - ->join('tab_promote on promote_id = tab_promote.id', 'left') - ->where($map) - ->group('promote_id1') -// ->having('promote_id != 0') - ->order('count desc,register_time') - ->select(); + + if (isset($_REQUEST['server_id'])) { + $play_info_map .= " and upi.server_name = '{$_REQUEST['server_id']}' "; } + + + $data = M('promote', 'tab_')->alias('tp1')->field('tp1.account as promote_account,tp1.id, date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time, count(u.id) as count, + count(IF(register_time ' . $today . ',1,null)) as today, + count(IF(register_time ' . $week . ',1,null)) as week, + count(IF(register_time ' . $mounth . ',1,null)) as mounth') + ->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%')", 'left') + ->join("tab_user as u on tp2.id = u.promote_id", 'left') + ->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false) + ->where($map) + ->group('tp1.id') + ->order('count desc, register_time') + ->select(); + $count = count($data); foreach ($data as $key => $value) { static $i = 0; @@ -530,14 +511,14 @@ class PlatformController extends ThinkController ->group('promote_id') ->select(false); } + $promote_map = "tp1.`chain` = '/'"; if (isset($_REQUEST['promote_id'])) { - $condition['_string'] = "promote_id = {$_REQUEST['promote_id']} or tab_promote.parent_id = {$_REQUEST['promote_id']} or tab_promote.grand_id = {$_REQUEST['promote_id']} "; + $promote_map = "tp1.`id` = {$_REQUEST['promote_id']}"; unset($_REQUEST['promote_id']); } - $data = $spend->field('a.promote_account,a.promote_id,a.time,sum(a.scount) as count,sum(a.today) as today,sum(a.week) as week,sum(a.mounth) as mounth,IF(tab_promote.grand_id>0,tab_promote.grand_id,IF(tab_promote.grand_id=0 and tab_promote.parent_id >0,tab_promote.parent_id,promote_id)) as promote_id1') - ->join('tab_promote on promote_id = tab_promote.id', 'left') - ->where($condition) - ->table('(' . $data . ') as a')->group('promote_id1')->order('count desc,a.ordertime')->select(); + $data = $spend->field('t.pid as promote_id,t.promote_account,sum(a.scount) AS count,sum(a.today) AS today,sum(a. WEEK) AS WEEK,sum(a.mounth) AS mounth') + ->join("INNER JOIN (SELECT tp2.*, tp1.id AS pid, tp1.account as promote_account FROM tab_promote tp1 LEFT JOIN tab_promote tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') where $promote_map ) AS t ON promote_id = t.id") + ->where($condition)->table('(' . $data . ') as a')->group('t.pid')->order('count desc,a.ordertime')->select(); $count = count($data); // dump($condition);die; foreach ($data as $key => $value) { diff --git a/Application/Admin/Controller/access_data_foldline.txt b/Application/Admin/Controller/access_data_foldline.txt index 2d8d3add6..f2bc7fb38 100644 --- a/Application/Admin/Controller/access_data_foldline.txt +++ b/Application/Admin/Controller/access_data_foldline.txt @@ -1 +1 @@ -{"news":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":21},{"time":"17:00","count":10},{"time":"18:00","count":7},{"time":"19:00","count":11},{"time":"20:00","count":11},{"time":"21:00","count":8},{"time":"22:00","count":11},{"time":"23:00","count":10}],"sum":{"news":89,"active":2506,"player":378,"money":33093},"active":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":851},{"time":"17:00","count":280},{"time":"18:00","count":142},{"time":"19:00","count":105},{"time":"20:00","count":81},{"time":"21:00","count":143},{"time":"22:00","count":420},{"time":"23:00","count":484}],"player":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":179},{"time":"17:00","count":54},{"time":"18:00","count":28},{"time":"19:00","count":24},{"time":"20:00","count":14},{"time":"21:00","count":12},{"time":"22:00","count":27},{"time":"23:00","count":40}],"money":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":"15639.00"},{"time":"17:00","count":"5328.00"},{"time":"18:00","count":"5490.00"},{"time":"19:00","count":"1178.00"},{"time":"20:00","count":"1274.00"},{"time":"21:00","count":"484.00"},{"time":"22:00","count":"2327.00"},{"time":"23:00","count":"1373.00"}]} \ No newline at end of file +{"news":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"sum":{"news":0,"active":0,"player":0,"money":0},"active":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"player":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"money":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}]} \ No newline at end of file diff --git a/Application/Admin/View/Platform/promote_statistics.html b/Application/Admin/View/Platform/promote_statistics.html index 58469f325..597ab3889 100644 --- a/Application/Admin/View/Platform/promote_statistics.html +++ b/Application/Admin/View/Platform/promote_statistics.html @@ -136,18 +136,19 @@ - + {$data['promote_account']} + - {$data.count} + {$data.count} {$data.rand}{$data.rand}{$data.rand}{$data.rand} {$data.today} {$data.week} {$data.mounth} - + diff --git a/Application/Admin/View/Platform/promotepay_statistics.html b/Application/Admin/View/Platform/promotepay_statistics.html index db158299d..44b9b0151 100644 --- a/Application/Admin/View/Platform/promotepay_statistics.html +++ b/Application/Admin/View/Platform/promotepay_statistics.html @@ -119,7 +119,7 @@ - {:get_promote_name($data['promote_id1'])} + {$data['promote_account']} {$data.count} {$data.rand}{$data.rand}{$data.rand}{$data.rand} {$data.today}