From 2ecb05d9249b8db96a4632f66c9185909539326c Mon Sep 17 00:00:00 2001 From: sunke <18850253506@163.com> Date: Thu, 5 Mar 2020 11:39:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E4=BB=98=E6=B8=A0=E9=81=93=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/PayChannelController.class.php | 68 ++++++++++++++++--- Application/Admin/View/PayChannel/index.html | 10 +++ 2 files changed, 67 insertions(+), 11 deletions(-) diff --git a/Application/Admin/Controller/PayChannelController.class.php b/Application/Admin/Controller/PayChannelController.class.php index 9035e9e2b..873cf24a0 100644 --- a/Application/Admin/Controller/PayChannelController.class.php +++ b/Application/Admin/Controller/PayChannelController.class.php @@ -22,31 +22,34 @@ class PayChannelController extends ThinkController } $map = []; - if (!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) { $map['pay_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]); $coinMap['tab_deposit.create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]); $bindMap['create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]); $offcialmap['create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]); $spreadMap['create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]); + $maptestorder['pay_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]); } elseif (!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) { $map['pay_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]); $coinMap['tab_deposit.create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]); $bindMap['create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]); $offcialmap['create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]); $spreadMap['create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]); + $maptestorder['pay_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]); } elseif (empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) { $map['pay_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399)); $coinMap['tab_deposit.create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399)); $bindMap['create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399)); $offcialmap['create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399)); $spreadMap['create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399)); + $maptestorder['pay_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399)); } if (!empty($_REQUEST['game_id'])) { $map['game_id'] = $_REQUEST['game_id']; $bindMap['game_id'] = $_REQUEST['game_id']; $coinMap['game_id'] = $_REQUEST['game_id']; + $maptestorder['game_id'] = $_REQUEST['game_id']; } $map['pay_status'] = $coinMap['pay_status'] = 1; @@ -186,7 +189,7 @@ class PayChannelController extends ThinkController $this->assign('spreadData',$spreadData); $channelData = $this->getPayChannel($map); - + $testOrderChannelDatas = $this->getTestOrderPayChannel($maptestorder); $payTypeData['支付宝支付金额'] = 0; $payTypeData['微信支付金额'] = 0; $payTypeData['快捷支付金额'] = 0; @@ -207,16 +210,36 @@ class PayChannelController extends ThinkController } $this->assign('payTypeData',$payTypeData); - + $pay_way_arr = []; + foreach($channelData as $pay_way_key => $channelData_payway) { + $pay_way_arr[$pay_way_key] = $channelData_payway['pay_way']; + } + $testorderChannelArr = []; foreach($channelData as $key=>$value) { - $channelData[$key]['pay_amount'] = number_format($value['pay_amount'],2,'.',''); - $channelData[$key]['pay_way'] = get_pay_way($value['pay_way']); + foreach($testOrderChannelDatas as $trkey => $testOrderChannelData) { + if(intval($value['pay_way']) == intval($testOrderChannelData['pay_way'])) { + $channelData[$key]['pay_amount'] = number_format(($value['pay_amount'] + $testOrderChannelData['pay_amount']) ,2,'.',''); + $channelData[$key]['pay_way'] = get_pay_way($value['pay_way']); + break; + } + else if (!in_array(intval($testOrderChannelData['pay_way']),$pay_way_arr)) { + // $channelData[$testOrderChannelData['pay_way']]['pay_amount'] = number_format($testOrderChannelData['pay_amount'],2,'.',''); + $testorderChannelArr[$trkey]['pay_amount'] = number_format($testOrderChannelData['pay_amount'],2,'.',''); + $testorderChannelArr[$trkey]['pay_way'] = get_pay_way($testOrderChannelData['pay_way']); + } + else { + $channelData[$key]['pay_amount'] = number_format($value['pay_amount'],2,'.',''); + $channelData[$key]['pay_way'] = get_pay_way($value['pay_way']); + } + + } + // $channelData[$key]['pay_way'] = get_pay_way($value['pay_way']); if (!$value['pay_way']) { unset($channelData[$key]); } } - + $count = count($data); $page = set_pagination($count, $row); @@ -249,7 +272,7 @@ class PayChannelController extends ThinkController $sumData['test_platform_coin'] +=$handleTestCoinData[$value['game_id']]?$handleTestCoinData[$value['game_id']]:0; } - //汇总数据 + // 汇总数据 if ($_REQUEST['game_id']) { $sumData['platform_coin'] = $sumData['platform_coin'] - $sumData['test_platform_coin']; $sumData['test_coin'] = $sumData['test_coin']+$sumData['test_platform_coin']; @@ -313,15 +336,18 @@ class PayChannelController extends ThinkController $this->meta_title = "支付渠道统计"; $size = $row;//每页显示的记录数 $data = array_slice($data, ($arraypage - 1) * $size, $size); - + $sum_pay_amount = M('test_order', 'tab_')->where($maptestorder)->field('sum(pay_amount) as sum_order_amount')->find(); //平台币直充金额,下面列表 $this->assign('coinSum',$coinSum); + $channelData2 = $channelData; + $arr_merge = array_merge($channelData2,$testorderChannelArr); - $this->assign('sumData',$sumData); - $this->assign('channelData',$channelData); - $this->assign('listdata',$data); + $this->assign('sumData',$sumData); + $this->assign('channelData',$arr_merge); + $this->assign('listdata',$data); //统计总额和比例 $this->assign('channelData2',$channelData); + $this->assign('sum_pay_amount',$sum_pay_amount); $moneyAllCount = array_sum(array_column($channelData, 'pay_amount')); $this->assign('moneyAllCount',$moneyAllCount); $this->display(); @@ -356,6 +382,26 @@ class PayChannelController extends ThinkController } + public function add_array($array_1, $array_2) { + $array_merge = array_merge_recursive($array_1, $array_2); + foreach($array_merge as $key => $value) { + if(is_array($value)) + $array_merge[$key] = array_sum($value); + } + return $array_merge; + } + + + public function getTestOrderPayChannel($map) { + $testOrderChannelData = M('test_order','tab_') + ->field('sum(pay_amount) as pay_amount,pay_way') + ->where($map) + ->group('pay_way') + ->select(); + return $testOrderChannelData; + + } + public function getPayChannel($map) { //支付 //游戏订单渠道 diff --git a/Application/Admin/View/PayChannel/index.html b/Application/Admin/View/PayChannel/index.html index 57bd324d6..ab7148a58 100644 --- a/Application/Admin/View/PayChannel/index.html +++ b/Application/Admin/View/PayChannel/index.html @@ -218,6 +218,16 @@ ------ + + 测试环境内外网平台 + {$sum_pay_amount['sum_order_amount']}0 + 0 + 0 + {$sum_pay_amount['sum_order_amount']}0 + + 订单查看 + + 充值方式统计