From 53a235379a77e4d8576e01784ea6bf9d433f47db Mon Sep 17 00:00:00 2001 From: liuweiwen <“529520975@qq.com> Date: Tue, 17 Dec 2019 16:07:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=B8=E6=88=8F=E8=AE=A2=E5=8D=95=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B-=E5=AF=BC=E5=87=BAexcell?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/ExportController.class.php | 79 +++++++++++++++++++ .../Controller/FinanceController.class.php | 46 ++--------- .../Admin/View/Finance/gameStatistics.html | 3 +- .../View/Finance/gameStatisticsDetail.html | 2 +- 4 files changed, 89 insertions(+), 41 deletions(-) diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index 034046398..bc21c9332 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -6511,6 +6511,85 @@ if ($key == 'model'){ $this->exportExcel($xlsName, $xlsCell, $xlsData); } + public function gameStatisticsDetail() { + $game_name = I("game_name"); + $xlsName = $game_name . '游戏订单查看'; + + $xlsCell = array( + array('pay_order_number','支付订单号'), + array('extend','游戏订单号'), + array('pay_time','充值时间'), + array('user_account','玩家账号'), + array('game_name','游戏名称'), + array('promote_account','所属推广员'), + array('spend_ip','充值ip'), + array('server_name','游戏区服'), + array('game_player_name','角色名称'), + array('cost','订单金额'), + array('pay_amount','实付金额'), + array('pay_way','充值方式'), + ); + + if (isset($_REQUEST['pay_way'])) { + $map['pay_way'] = $_REQUEST['pay_way']; + } + + if (!empty($_REQUEST['pay_order_number'])) { + $map['pay_order_number'] = $_REQUEST['pay_order_number']; + } + + if (!empty(I('partner_id'))&&empty(I("game_id"))) { + $wherePartner = I('partner_id'); + $gameId = M("game","tab_")->field("id")->where("partner_id={$wherePartner}")->select(); + $gameId = implode(',',array_column($gameId,'id')); + $map['game_id'] = ['in',$gameId]; + } + + if (!empty(I('timestart'))) { + $timestart = strtotime(I('timestart')); + $map['_string'] = "pay_time > {$timestart}"; + } + + if (!empty(I('timeend'))) { + $timeend = strtotime(I('timeend')); + $map['_string'] .= " and pay_time < {$timeend}"; + } + + $map['pay_status'] = 1; + if (!empty(I("game_id"))) { + $map['game_id'] = I("game_id"); + } + if (!empty(I('user_account'))) { + $map['user_account'] = array('like','%'.I("user_account").'%'); + } + if (!empty(I('user_nickname'))) { + $map['game_player_name'] = array('like',I("user_nickname").'%'); + } + + $field = "pay_order_number,FROM_UNIXTIME(pay_time) as pay_time,user_account,game_name,promote_account,spend_ip,server_name,game_player_name,pay_amount,cost,pay_way,extend"; + $group = ""; + $order = "pay_time DESC"; + + $xlsData = D('spend')->getSpendData($map,$field,$group,$order); + foreach($xlsData as $key => $value) { + $xlsData[$key]['pay_way'] = getPayType($value['pay_way']); + } + + $totalData = D("spend")->totalGameStatistics($map, false); + + $sumCash = $totalData['cash_count'] ?? 0; + $sumBalance = $totalData['balance_coin_count'] ?? 0; + $sumInside = $totalData['inside_cash_count'] ?? 0; + $sumAll = $sumCash + $sumBalance + $sumInside; + + $sumData = [['pay_order_number'=>'总计:' . $sumAll, + 'extend'=>'现金金额:' . $sumCash, + 'pay_time'=>'平台币:' . $sumBalance, + 'user_account'=>'绑币:' . $sumInside]]; + $xlsData = array_merge($xlsData,$sumData); + $this->exportExcel($xlsName, $xlsCell, $xlsData); + } + function gameFinanceDetail() { // set_time_limit(0); diff --git a/Application/Admin/Controller/FinanceController.class.php b/Application/Admin/Controller/FinanceController.class.php index e05c69fc5..509dbbc49 100644 --- a/Application/Admin/Controller/FinanceController.class.php +++ b/Application/Admin/Controller/FinanceController.class.php @@ -755,19 +755,6 @@ class FinanceController extends ThinkController public function gameStatisticsDetail($p = 1) { set_time_limit(0); - if (!empty(I("promote_id"))) { - $promote_id[] = I("promote_id"); - } - - if (!empty(I("root_id"))) { - $root_id = I("root_id"); - $promote_id = $this->getPromoteList($root_id); - array_push($promote_id,$root_id); - } - - if ($_REQUEST['root_id']=='0') { - $map['promote_id'] = $_REQUEST['root_id']; - } if (isset($_REQUEST['pay_way'])) { $map['pay_way'] = $_REQUEST['pay_way']; @@ -777,17 +764,6 @@ class FinanceController extends ThinkController $map['pay_order_number'] = $_REQUEST['pay_order_number']; } - if (!empty(I("parent_id"))) { - $parent_id = I("parent_id"); - $promote_id = $this->getPromoteList($parent_id); - array_push($promote_id,$parent_id); - } - - $promote_id = implode(',',$promote_id); - if ($promote_id) { - $map['promote_id'] = ['in',$promote_id]; - } - if (!empty(I('partner_id'))&&empty(I("game_id"))) { $wherePartner = I('partner_id'); $gameId = M("game","tab_")->field("id")->where("partner_id={$wherePartner}")->select(); @@ -807,17 +783,11 @@ class FinanceController extends ThinkController // var_dump($map);die(); $page = intval($p); $page = $page ? $page : 1; //默认显示第一页数据 - $row=10; - if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;} - - if (!empty(I("count_date"))) { - $month = I("count_date"); - $tarry = explode('-',$month); - $startTime=mktime(0,0,0,$tarry[1],1,$tarry[0]); - $endTime =mktime(0,0,0,$tarry[1]-0+1,1,$tarry[0])-1; - $map['pay_time'] = array('between',array($startTime,$endTime)); + if (isset($_REQUEST['row'])) { + $row = $_REQUEST['row']; + } else { + $row = 10; } - $map['pay_status'] = 1; if (!empty(I("game_id"))) { $map['game_id'] = I("game_id"); @@ -833,16 +803,14 @@ class FinanceController extends ThinkController $group = ""; $order = "pay_time DESC"; $data = D('spend')->getSpendData($map,$field,$group,$order,$page,$row); -// echo D("spend")->_sql();die(); - foreach($data as $key => $value) { $data[$key]['pay_way'] = getPayType($value['pay_way']); } $totalData = D('spend')->totalGameStatistics($map, false); - $sumCash = $totalData['cash_count']; - $sumBalance = $totalData['balance_coin_count']; - $sumInside = $totalData['inside_cash_count']; + $sumCash = $totalData['cash_count'] ?? 0; + $sumBalance = $totalData['balance_coin_count'] ?? 0; + $sumInside = $totalData['inside_cash_count'] ?? 0; $sumAll = $sumCash + $sumBalance + $sumInside; $this->assign('sumCash', $sumCash); diff --git a/Application/Admin/View/Finance/gameStatistics.html b/Application/Admin/View/Finance/gameStatistics.html index 7855bbd89..0aa6f32f5 100644 --- a/Application/Admin/View/Finance/gameStatistics.html +++ b/Application/Admin/View/Finance/gameStatistics.html @@ -98,7 +98,7 @@
@@ -187,6 +187,7 @@ 'timeend'=>$_GET['timeend'], 'sdk_type'=>$_GET['sdk_type'], 'game_id'=>$data['game_id'], + 'game_name'=>$data['game_name'], 'partner_id'=>$_REQUEST['partner_id'], false))}" >查看 diff --git a/Application/Admin/View/Finance/gameStatisticsDetail.html b/Application/Admin/View/Finance/gameStatisticsDetail.html index 453ace6ef..d345138f5 100644 --- a/Application/Admin/View/Finance/gameStatisticsDetail.html +++ b/Application/Admin/View/Finance/gameStatisticsDetail.html @@ -92,7 +92,7 @@ 搜索 -