diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index bc21c9332..05a63d9d9 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -6590,6 +6590,110 @@ if ($key == 'model'){ $this->exportExcel($xlsName, $xlsCell, $xlsData); } + public function coinDetail() { + + $xlsCell = array( + array('pay_order_number','支付订单号'), + array('pay_time','充值时间'), + array('user_account','玩家账号'), + array('game_name','游戏名称'), + array('server_name','游戏区服'), + array('game_player_name','角色名称'), + array('cost','订单金额'), + array('pay_amount','实付金额'), + array('pay_way','充值方式'), + ); + $map = array(); + if (isset($_REQUEST['pay_way'])) { + $map['pay_way'] = $_REQUEST['pay_way']; + } + + $game_name = I("game_name"); + + 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['tab_spend.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}"; + } + + 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['tab_spend.promote_id'] = $_REQUEST['root_id']; + } + + $promote_id = implode(',',$promote_id); + if ($promote_id) { + $map['tab_spend.promote_id'] = ['in',$promote_id]; + } + + $map['pay_status'] = 1; + if (!empty(I("game_id"))) { + $map['tab_spend.game_id'] = I("game_id"); + } + if (!empty(I('user_account'))) { + $map['tab_spend.user_account'] = array('like','%'.I("user_account").'%'); + } + if (!empty(I('user_nickname'))) { + $map['tab_spend.game_player_name'] = array('like',I("user_nickname").'%'); + } + $field = "pay_order_number,FROM_UNIXTIME(pay_time) as pay_time,tab_spend.user_account, + tab_spend.user_nickname,tab_spend.game_name,tab_spend.promote_account,spend_ip,tab_spend.server_name, + game_player_name,pay_amount,cost,pay_way"; + $group = ""; + $order = "pay_time DESC"; + $join = false; + if ($map['pay_way'] ==-1) {//绑定币 + $xlsCell[] = array('bind_balance','绑定币余额'); + $xlsName = $game_name . '内充支出明细'; + $field2 = $field . ',bind_balance'; + $join = 'left join tab_user_play as p on p.user_id = tab_spend.user_id and tab_spend.game_id=p.game_id'; + } elseif ($map['pay_way'] ==0) {//平台币 + $xlsCell[] = array('balance','平台币余额'); + $xlsName = $game_name . '平台币直充明细'; + $field2 = $field . ',balance'; + $join = 'left join tab_user as u on u.id = tab_spend.user_id'; + } + $xlsData = D('spend')->getSpendData($map, $field2, $group, $order, 0, 0, $join); + + foreach($xlsData as $key => $value) { + $xlsData[$key]['pay_way'] = getPayType($value['pay_way']); + } + + $map['pay_game_status'] = 1; + $total_cost = D('spend')->sumSpend($map, 'cost'); + $total_pay_amount = D('spend')->sumSpend($map, 'pay_amount'); + + $sumData = [['pay_order_number'=>'总计', + 'cost'=> $total_cost, + 'pay_amount'=> $total_pay_amount]]; + $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 509dbbc49..5100aeab6 100644 --- a/Application/Admin/Controller/FinanceController.class.php +++ b/Application/Admin/Controller/FinanceController.class.php @@ -780,7 +780,26 @@ class FinanceController extends ThinkController $timeend = strtotime(I('timeend')); $map['_string'] .= " and pay_time < {$timeend}"; } -// var_dump($map);die(); + + 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']; + } + + $promote_id = implode(',',$promote_id); + if ($promote_id) { + $map['promote_id'] = ['in',$promote_id]; + } + $page = intval($p); $page = $page ? $page : 1; //默认显示第一页数据 if (isset($_REQUEST['row'])) { @@ -826,11 +845,116 @@ class FinanceController extends ThinkController $this->meta_title = '游戏订单查看'; $this->assign('data',$data); + $from = I('from', ''); + $this->display($from); + } + + public function coinDetail($p = 1) { + + set_time_limit(0); + + if (isset($_REQUEST['pay_way'])) { + $map['pay_way'] = $_REQUEST['pay_way']; + $this->assign('pay_way', $map['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['tab_spend.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}"; + } + + 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['tab_spend.promote_id'] = $_REQUEST['root_id']; + } + + $promote_id = implode(',',$promote_id); + if ($promote_id) { + $map['tab_spend.promote_id'] = ['in',$promote_id]; + } + + $page = intval($p); + $page = $page ? $page : 1; //默认显示第一页数据 + if (isset($_REQUEST['row'])) { + $row = $_REQUEST['row']; + } else { + $row = 10; + } + $map['pay_status'] = 1; + if (!empty(I("game_id"))) { + $map['tab_spend.game_id'] = I("game_id"); + } + if (!empty(I('user_account'))) { + $map['tab_spend.user_account'] = array('like','%'.I("user_account").'%'); + } + if (!empty(I('user_nickname'))) { + $map['tab_spend.game_player_name'] = array('like',I("user_nickname").'%'); + } +// var_dump($map);die(); + $field = "pay_order_number,FROM_UNIXTIME(pay_time) as pay_time,tab_spend.user_account, + tab_spend.user_nickname,tab_spend.game_name,tab_spend.promote_account,spend_ip,tab_spend.server_name, + game_player_name,pay_amount,cost,pay_way"; + $group = ""; + $order = "pay_time DESC"; + $join = false; + if ($map['pay_way'] ==-1) {//绑定币 + $field2 = $field . ',bind_balance'; + $join = 'left join tab_user_play as p on p.user_id = tab_spend.user_id and tab_spend.game_id=p.game_id'; + } elseif ($map['pay_way'] ==0) {//平台币 + $field2 = $field . ',balance'; + $join = 'left join tab_user as u on u.id = tab_spend.user_id'; + } + + $data = D('spend')->getSpendData($map, $field2, $group, $order, $page, $row, $join); + + foreach($data as $key => $value) { + $data[$key]['pay_way'] = getPayType($value['pay_way']); + } + $count = D("spend")->getSpendData($map,$field,$group,$order); + $count = count($count); + $page = set_pagination($count,$row); + + + $map['pay_game_status'] = 1; + $total_cost = D('spend')->sumSpend($map, 'cost');//订单金额合计 + $total_pay_amount = D('spend')->sumSpend($map, 'pay_amount');//实付金额合计 + + $this->assign('total_cost', $total_cost); + $this->assign('total_pay_amount', $total_pay_amount); + + if($page) {$this->assign('_page', $page);} + $this->meta_title = '游戏订单查看'; + + $this->assign('data',$data); $this->display(); } - /** *获取合作公司 */ diff --git a/Application/Admin/Model/SpendModel.class.php b/Application/Admin/Model/SpendModel.class.php index c761281c6..31a4385f2 100644 --- a/Application/Admin/Model/SpendModel.class.php +++ b/Application/Admin/Model/SpendModel.class.php @@ -810,14 +810,17 @@ class SpendModel extends Model /** * 获取统计 $map,$page,$row */ - public function getSpendData($map = [], $field = '', $group = '', $order = '', $page = 0, $row = 0) + public function getSpendData($map = [], $field = '', $group = '', $order = '', $page = 0, $row = 0, $join = false) { + $query = $this->field($field)->where($map)->group($group)->order($order); + if ($join) { + $query = $query->join($join); + } if ($row == 0) { - $data = $this->field($field)->where($map)->group($group)->order($order)->select(); + $data = $query->select(); } else { - $data = $this->field($field)->where($map)->page($page, $row)->group($group)->order($order)->select(); + $data = $query->page($page, $row)->select(); } - return $data; } @@ -844,7 +847,7 @@ SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count, SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as inside_cash_count") ->join('LEFT JOIN tab_game as g ON s.game_id=g.id') ->join('LEFT JOIN tab_partner as p ON g.partner_id=p.id') - ->where(['s.pay_status' => 1]) + ->where(['s.pay_status' => 1, 'pay_game_status' => 1]) ->where($map) ->group('s.game_id'); if ($row) { @@ -867,7 +870,7 @@ SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as inside_cash_count"); $query = $query->join('LEFT JOIN tab_game as g ON s.game_id=g.id') ->join('LEFT JOIN tab_partner as p ON g.partner_id=p.id'); } - $data = $query->where(['s.pay_status' => 1]) + $data = $query->where(['s.pay_status' => 1, 'pay_game_status' => 1]) ->where($map) ->find(); return $data; diff --git a/Application/Admin/View/Finance/coinDetail.html b/Application/Admin/View/Finance/coinDetail.html new file mode 100644 index 000000000..9cae74e66 --- /dev/null +++ b/Application/Admin/View/Finance/coinDetail.html @@ -0,0 +1,146 @@ + + + + + + 游戏登陆列表|----软件管理平台 + + + + + + + + + + +
+ + +
+ + +
+ + + + + +
+   +
+
+ +   +
+
+ +   +
+ +
+ 搜索 + + 导出 + +
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
支付订单号充值时间玩家账号游戏名称游戏区服角色名称订单金额实付金额充值方式绑定币余额平台币余额
{$data.pay_order_number}{$data.pay_time}{$data.user_account}{$data.game_name}{$data.server_name}{$data.game_player_name}{$data.cost}{$data.pay_amount}{$data.pay_way}{$data.bind_balance}{$data.balance}
总计{$total_cost}0{$total_pay_amount}0
+
+
+
+ {$_page} +
+  +
+ + + + + diff --git a/Application/Admin/View/Finance/gameStatistics.html b/Application/Admin/View/Finance/gameStatistics.html index 0aa6f32f5..fbd946c96 100644 --- a/Application/Admin/View/Finance/gameStatistics.html +++ b/Application/Admin/View/Finance/gameStatistics.html @@ -178,8 +178,26 @@ {$data.partner_name} {$data.game_name} {$data.cash_count}0 - {$data.balance_coin_count}0 - {$data.inside_cash_count}0 + + {$data.balance_coin_count}0 + {$data.inside_cash_count}0 {$data.all_cash_count}0 + function reloadIframe(url) { + $("iframe").attr('src', url); + // document.getElementsByTagName('iframe').src=url; + } + + $(".coin-detail").click(function () { + var pay_type = $(this).data('pay_type'); + var url = $(this).data('url'); + var title = pay_type == -1 ? '内充支出明细' : '平台币直充明细'; + layer.open({ + type: 2, + title: title, + shadeClose: true, + shade: 0.8, + area: ['70%', '80%'], + content: [url, 'no'] + }); + }); + + $('.page a').click(function () { var href = $(this).attr('href'); $(this).removeAttr('href'); @@ -251,6 +289,7 @@ //搜索功能 $("#search").click(function(){ + console.log(111); var starttime = $.trim($('#time-start').val()); var endtime = $.trim($('#time-end').val()); diff --git a/Application/Admin/View/Finance/gameStatisticsDetail.html b/Application/Admin/View/Finance/gameStatisticsDetail.html index d345138f5..e214d9453 100644 --- a/Application/Admin/View/Finance/gameStatisticsDetail.html +++ b/Application/Admin/View/Finance/gameStatisticsDetail.html @@ -54,10 +54,10 @@   - +
- - +   +