From 7415853c7d420f14a2dcdfd5d11d7b1018df9d7b Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Tue, 17 Dec 2019 17:53:19 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=B9=B3=E5=8F=B0>?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=AE=A1=E7=90=86>=E5=85=85=E5=80=BC?= =?UTF-8?q?=E7=8E=A9=E5=AE=B6--=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/DownloadController.class.php | 87 ++++++++++++------- 1 file changed, 57 insertions(+), 30 deletions(-) diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php index 1b4ba9afa..695c1c244 100644 --- a/Application/Home/Controller/DownloadController.class.php +++ b/Application/Home/Controller/DownloadController.class.php @@ -1188,6 +1188,9 @@ class DownloadController extends BaseController { $gameMap['sdk_version'] = $sdkVersion; } $gameId1 = M('game', 'tab_')->where($gameMap)->getField('id', true); + if(empty($gameId1)) { + $gameId1 = [-100]; + } $map['game_id'] = ['in', $gameId1]; } empty(I('server_id')) || $map['tab_pay_info.server_id'] = I('server_id'); @@ -1196,13 +1199,14 @@ class DownloadController extends BaseController { empty(I('extend')) || $map['tab_pay_info.extend'] = I('extend'); empty(I('user_id')) || $map['tab_pay_info.game_player_id'] = I('user_id'); if (!empty($begTime) && !empty($endTime)) { - $map['tab_pay_info.create_time'] = ['between', [strtotime($begTime), strtotime($endTime) - 1]]; + $map['tab_pay_info.create_time'] = ['between', [strtotime($begTime), strtotime($endTime) +24*3600- 1]]; }else if (empty($begTime) && !empty($endTime)) { - $map['tab_pay_info.create_time'] = ['elt',strtotime($endTime)]; + $map['tab_pay_info.create_time'] = ['elt',strtotime($endTime) + 24*3600]; }else if (!empty($begTime) && empty($endTime)) { - $map['tab_pay_info.create_time'] = ['EGT',strtotime($begTime)]; + $map['tab_pay_info.create_time'] = ['EGT',strtotime($begTime) + 24*3600]; } + $conditions = json_encode($map,TRUE); $addtime = time(); $data = [ @@ -1381,6 +1385,9 @@ class DownloadController extends BaseController { $gameMap['sdk_version'] = $sdkVersion; } $gameId1 = M('game', 'tab_')->where($gameMap)->getField('id', true); + if(empty($gameId1)) { + $gameId1 = [-100]; + } $map['game_id'] = ['in', $gameId1]; $subMap['game_id'] = ['in', $gameId1]; } @@ -1503,6 +1510,9 @@ class DownloadController extends BaseController { $gameMap['sdk_version'] = $sdkVersion; } $gameId1 = M('game', 'tab_')->where($gameMap)->getField('id', true); + if(empty($gameId1)) { + $gameId1 = [-100]; + } $map['game_id'] = ['in', $gameId1]; } if ($serverId > 0) { @@ -1602,6 +1612,9 @@ class DownloadController extends BaseController { $gameMap['sdk_version'] = $sdkVersion; } $gameId1 = M('game', 'tab_')->where($gameMap)->getField('id', true); + if(empty($gameId1)) { + $gameId1 = [-100]; + } $map['game_id'] = ['in', $gameId1]; } if ($serverId != 0) { @@ -1895,14 +1908,17 @@ class DownloadController extends BaseController { ->limit(($i-1)*$perSize ,$perSize)->select(); foreach($data as $key => $v) { $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); - $promoteInfo = M('promote','tab_')->field("nickname")->where(['id' => intval($v['promote_id'])])->find(); - $v['promote_id']= $promoteInfo['nickname']; + $promoteInfo = M('promote','tab_')->field("account")->where(['id' => intval($v['promote_id'])])->find(); + $serverId = $v['server_id']; + $gameId = $v['game_id']; + $serverInfo = M('server','tab_')->field('server_name')->where(['server_num'=>$serverId,'game_id'=>$gameId])->find(); + $v['promote_id']= $promoteInfo['account']; $csvData['extend'] = $this->encryption($v['extend']); $csvData['create_time'] = $v['create_time']; $csvData['user_account'] = $v['user_account']; $csvData['game_name'] = $v['game_name']; $csvData['promote_id'] = $v['promote_id']; - $csvData['server_name'] = $v['server_name']; + $csvData['server_name'] = $serverInfo['server_name']; $csvData['user_id'] = $v['game_player_id']; $csvData['game_player_name'] = $v['game_player_name']; $csvData['price'] = $v['price']; @@ -3162,7 +3178,7 @@ class DownloadController extends BaseController { unset($map['costbegin']); unset($map['costend']); $nowTime = strtotime(date('Y-m-d 00:00:00', time())); - $subMap['create_time'] = ['between', [$map['begintime'], $map['endtime'] - 1]]; + $subMap['create_time'] = ['between', [$map['begintime'], $map['endtime']-1]]; if ($costBegin != '' || $costEnd != '') { $having = ''; if ($costBegin != '' && $costEnd != '') { @@ -3180,35 +3196,43 @@ class DownloadController extends BaseController { $map['_string'] = 'ui.role_id in (' . $subQuery . ')'; } $secondDay = 24*3600 + 1; - $map['uc.create_time'] = ['between', [$map['begintime'], $map['endtime'] - $secondDay]]; + $map['uc.create_time'] = ['between', [$map['begintime'], $map['endtime']-1]]; unset($map['begintime']); unset($map['endtime']); //$spendMap['_string'] = 'uc.game_id = tab_user_play_info.game_id and uc.server_id = tab_user_play_info.server_id and uc.role_id = tab_user_play_info.role_id'; - - $fieldUC = "sum(uc.recharge_cost) recharge_cost,sum(uc.recharge_count) recharge_count,sum(if(uc.create_time = {$nowTime},uc.recharge_cost,0)) as recharge_cost_today"; - $fieldUI = "ui.user_account,ui.game_name,ui.role_name,ui.role_level,ui.server_name,ui.play_time,ui.play_ip,ui.promote_account,ui.sdk_version,ui.create_time"; - $loginRecordMap['lr.create_time'] = $map['uc.create_time']; - $loginRecordMap['_string'] = 'lr.user_id = uc.user_id and lr.game_id = uc.game_id'; - $fieldLR = M('login_daily_record', 'tab_')->alias('lr') - ->field("count(*) as count") - ->where($loginRecordMap) - ->buildSql(); - $field = $fieldUC . ',' . $fieldUI . ',' . $fieldLR . ' as user_game_login_count'; - $subQuery = M('user_play_data_count', 'tab_')->alias('uc') - ->field($field) - ->join('left join tab_user_play_info as ui on ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id') - ->where($map) - ->group('uc.role_id,uc.server_id,uc.game_id') - ->buildSql(); + + $fieldUC = "sum(uc.recharge_cost) recharge_cost,sum(uc.recharge_count) recharge_count,sum(if(uc.create_time = {$nowTime},uc.recharge_cost,0)) as recharge_cost_today,uc.user_id"; + $fieldUI = "ui.user_account,ui.game_name,ui.role_name,ui.role_level,ui.server_name,ui.play_time,ui.play_ip,ui.promote_account,ui.sdk_version,ui.create_time"; + + $loginRecordMap['lr.create_time'] = $map['uc.create_time']; + $loginRecordMap['_string'] = 'lr.user_id = uc.user_id and lr.game_id = uc.game_id'; + $fieldLR = M('login_daily_record', 'tab_')->alias('lr') + ->field("count(*) as count") + ->where($loginRecordMap) + ->buildSql(); + $field = $fieldUC . ',' . $fieldUI . ',' . $fieldLR . ' as user_game_login_count'; + $subQuery = M('user_play_data_count', 'tab_')->alias('uc') + ->field($field) + ->join('left join tab_user_play_info as ui on ui.user_id = uc.user_id and ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id') + ->where($map) + ->group('uc.role_id,uc.server_id,uc.game_id') + ->buildSql(); $roles = M()->alias('record') ->table($subQuery) ->select(); - $total = []; - $total = M('user_play_data_count', 'tab_')->alias('uc') - ->field($fieldUC) - ->join('left join tab_user_play_info as ui on ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id') - ->where($map) - ->find(); + $totalQuery = M('user_play_data_count', 'tab_')->alias('uc') + ->field($fieldUC) + ->join('left join tab_user_play_info as ui on ui.user_id = uc.user_id and ui.game_id = uc.game_id and uc.server_id = ui.server_id and ui.role_id = uc.role_id') + ->group('uc.role_id,uc.game_id,uc.server_id,uc.user_id') + ->where($map) + ->buildSql(); + $total = M()->alias('totals') + ->table($totalQuery) + ->field('sum(recharge_cost) recharge_cost,sum(recharge_count) recharge_count,sum(recharge_cost_today) as recharge_cost_today') + ->find(); + $userIds = array_column($roles, 'user_id'); + $userIds = $userIds ?? [-1]; + $users = M('user', 'tab_')->where(array('id' => ['in', $userIds]))->getField('id, account', true); $csvFileName = $xlsName.'.csv'; //设置好告诉浏览器要下载excel文件的headers header('Content-Description: File Transfer'); @@ -3231,6 +3255,9 @@ class DownloadController extends BaseController { ->limit(($i-1)*$perSize ,$perSize) ->select(); foreach($data as $key => $value) { + if (empty($value['user_account']) ) { + $value['user_account'] = $users[$value['user_id']] ?? ''; + } $csvData['user_account'] = empty($value['user_account']) ? '--' : encryption($value['user_account']); $csvData['game_name'] = empty($value['game_name']) ? '--' :$value['game_name']; $csvData['server_name'] = empty($value['server_name']) ? '--' :$value['server_name']; From e9f8e40e48f351de28651563de934751352345d4 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Tue, 17 Dec 2019 17:58:07 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=B9=B3=E5=8F=B0>?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=AE=A1=E7=90=86>=E5=85=85=E5=80=BC?= =?UTF-8?q?=E7=8E=A9=E5=AE=B6--=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Home/View/default/Query/userRecharges.html | 1 + 1 file changed, 1 insertion(+) diff --git a/Application/Home/View/default/Query/userRecharges.html b/Application/Home/View/default/Query/userRecharges.html index 541918ba3..6cff84622 100644 --- a/Application/Home/View/default/Query/userRecharges.html +++ b/Application/Home/View/default/Query/userRecharges.html @@ -85,6 +85,7 @@
+ From ad0b88553ba7ca6d0752a66257fa903315ca2d97 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Tue, 17 Dec 2019 19:21:13 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=B9=B3=E5=8F=B0>?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=AE=A1=E7=90=86>=E5=85=85=E5=80=BC?= =?UTF-8?q?=E7=8E=A9=E5=AE=B6--=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Home/Controller/QueryController.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index d20e9e931..76728d4cf 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -1798,7 +1798,9 @@ class QueryController extends BaseController $map['ui.role_name'] = ['like', $roleName . '%']; } if ($userAccount != '') { - $map['ui.user_account'] = ['like', $userAccount . '%']; + $userId = M('user', 'tab_')->where(array('account' => ['like', $userAccount . '%']))->getField('id'); + $userId = $userId ?? 0; + $map['uc.user_id'] = $userId; } if ($isSelf) { $map['uc.promote_id'] = $queryPromote['id']; From bb17441528615abcc3cf63b5420642eb45680fc9 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Tue, 17 Dec 2019 19:24:32 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=B9=B3=E5=8F=B0>?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=AE=A1=E7=90=86>=E5=85=85=E5=80=BC?= =?UTF-8?q?=E7=8E=A9=E5=AE=B6--=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Home/Controller/DownloadController.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php index 695c1c244..c5b4f1c00 100644 --- a/Application/Home/Controller/DownloadController.class.php +++ b/Application/Home/Controller/DownloadController.class.php @@ -3166,8 +3166,10 @@ class DownloadController extends BaseController { } if(!empty($map['user_account'])) { - $map['ui.user_account'] = $map['user_account']; - unset($map['user_account']); + $userId = M('user', 'tab_')->where(array('account' => ['like', $map['user_account'] . '%']))->getField('id'); + $userId = $userId ?? 0; + $map['uc.user_id'] = $userId; + unset($map['user_account']); } if(!empty($map['promote_id'])) { $map['uc.promote_id'] = $map['promote_id']; From 19899157671014c569a00bfb62f962b3a11f84d4 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Tue, 17 Dec 2019 19:30:47 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=B9=B3=E5=8F=B0>?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=AE=A1=E7=90=86>=E5=85=85=E5=80=BC?= =?UTF-8?q?=E7=8E=A9=E5=AE=B6--=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Home/Controller/DownloadController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php index c5b4f1c00..50395dd30 100644 --- a/Application/Home/Controller/DownloadController.class.php +++ b/Application/Home/Controller/DownloadController.class.php @@ -3166,7 +3166,7 @@ class DownloadController extends BaseController { } if(!empty($map['user_account'])) { - $userId = M('user', 'tab_')->where(array('account' => ['like', $map['user_account'] . '%']))->getField('id'); + $userId = M('user', 'tab_')->where(array('account' => $map['user_account']))->getField('id'); $userId = $userId ?? 0; $map['uc.user_id'] = $userId; unset($map['user_account']); From a76214ee2238f73dd5dd1997cc45edb3fc55b97c Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Tue, 17 Dec 2019 19:45:01 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=B9=B3=E5=8F=B0>?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=AE=A1=E7=90=86>=E5=85=85=E5=80=BC?= =?UTF-8?q?=E7=8E=A9=E5=AE=B6--=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Home/Controller/DownloadController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php index 50395dd30..1f632a097 100644 --- a/Application/Home/Controller/DownloadController.class.php +++ b/Application/Home/Controller/DownloadController.class.php @@ -3233,7 +3233,7 @@ class DownloadController extends BaseController { ->field('sum(recharge_cost) recharge_cost,sum(recharge_count) recharge_count,sum(recharge_cost_today) as recharge_cost_today') ->find(); $userIds = array_column($roles, 'user_id'); - $userIds = $userIds ?? [-1]; + $userIds = $userIds ? $userIds : [-1]; $users = M('user', 'tab_')->where(array('id' => ['in', $userIds]))->getField('id, account', true); $csvFileName = $xlsName.'.csv'; //设置好告诉浏览器要下载excel文件的headers