From b94fb8d7945fec9a30b72a97463fb8307db28e16 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Wed, 18 Dec 2019 15:55:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E4=BC=9A=E7=BB=9F=E8=AE=A14?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FinancePromoteController.class.php | 198 +++++++- .../View/FinancePromote/gameStatistics.html | 448 ++++++++++++++++++ .../FinancePromote/gameStatisticsDetail.html | 327 +++++++++++++ .../Admin/View/FinancePromote/index.html | 5 +- .../View/FinancePromote/promoteUser.html | 11 +- 5 files changed, 972 insertions(+), 17 deletions(-) create mode 100644 Application/Admin/View/FinancePromote/gameStatistics.html create mode 100644 Application/Admin/View/FinancePromote/gameStatisticsDetail.html diff --git a/Application/Admin/Controller/FinancePromoteController.class.php b/Application/Admin/Controller/FinancePromoteController.class.php index 3a746b30d..fccc2fd1f 100644 --- a/Application/Admin/Controller/FinancePromoteController.class.php +++ b/Application/Admin/Controller/FinancePromoteController.class.php @@ -321,13 +321,199 @@ class FinancePromoteController extends AdminController } # code... } - private function data_total($data) + /** + *游戏统计 + */ + public function gameStatistics($p = 1) { + $page = intval($p); + $page = $page ? $page : 1; //默认显示第一页数据 + $row = $_REQUEST['row'] ?? 10; + + $map = []; + if (isset($_REQUEST['game_name']) || isset($_REQUEST['game_type'])) { + $map["s.game_id"] = array("in",implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) ); + } + if (!empty(I('partner_id'))) { + $map['g.partner_id'] = I('partner_id'); + } + + if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) { + $map['s.pay_time'] = ['between', [strtotime($_REQUEST['time_start']), strtotime($_REQUEST['time_end']) + 86399]]; + } elseif (isset($_REQUEST['time_start'])) { + $map['s.pay_time'] = ['GT', strtotime($_REQUEST['time_start'])]; + } elseif (isset($_REQUEST['time_end'])) { + $map['s.pay_time'] = ['LT', strtotime($_REQUEST['time_end']) + 86399]; + } + //判断是否有推广员 + if ($_REQUEST['promote_id'] != '') { + if ($_REQUEST['promote_id'] == 0 || $_REQUEST['promote_type'] == 2) { + $map['s.promote_id'] = $_REQUEST['promote_id']; + } else { + $promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select(); + if ($promoter_ids) { + $map['s.promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))]; + } + } + } + + //游戏统计列表 + $data =self::gameStatisticsData($map, $row, $p); + foreach ($data as $key => $value) { + $data[$key]['all_cash_count'] = $value['cash_count'] + $value['balance_coin_count'] + $value['inside_cash_count']; + } + + $allData = self::gameStatisticsData($map);//列表总数 + $count = count($allData); + $page = set_pagination($count, $row); + if ($page) { + $this->assign('_page', $page);//分页 + } + + //统计合计 + $totalData = self::totalGameStatisticsData($map); + + $sumCash = $totalData['cash_count']; + $sumBalance = $totalData['balance_coin_count']; + $sumInside = $totalData['inside_cash_count']; + $sumAll = $sumCash + $sumBalance + $sumInside; + + $this->assign('sumCash', $sumCash); + $this->assign('sumBalance', $sumBalance); + $this->assign('sumInside', $sumInside); + $this->assign('sumAll', $sumAll); + $this->assign('data',$data); + + $this->display(); + } + //游戏订单详情 + public function gameStatisticsDetail($p = 1) { + set_time_limit(0); + + 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}"; + } + + 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'])) { + $row = $_REQUEST['row']; + } else { + $row = 10; + } + $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").'%'); + } +// var_dump($map);die(); + $field = "pay_order_number,FROM_UNIXTIME(pay_time) as pay_time,user_account,user_nickname,game_name,promote_account,spend_ip,server_name,game_player_name,pay_amount,cost,pay_way"; + $group = ""; + $order = "pay_time DESC"; + $data = D('spend')->getSpendData($map,$field,$group,$order,$page,$row); + foreach($data as $key => $value) { + $data[$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; + + $this->assign('sumCash', $sumCash); + $this->assign('sumBalance', $sumBalance); + $this->assign('sumInside', $sumInside); + $this->assign('sumAll', null_to_0($sumAll)); + + $count = D("spend")->getSpendData($map,$field,$group,$order); + + $count = count($count); + $page = set_pagination($count,$row); + if($page) {$this->assign('_page', $page);} + $this->meta_title = '游戏订单查看'; + + $this->assign('data',$data); + $from = I('from', ''); + $this->display($from); + } + + private function gameStatisticsData($map, $row = 0, $page = 1) { - $total['sum_count'] = array_sum(array_column($data, 'count')); - $total['sum_today'] = array_sum(array_column($data, 'today')); - $total['sum_week'] = array_sum(array_column($data, 'week')); - $total['sum_mounth'] = array_sum(array_column($data, 'mounth')); - return $total; + $map['s.pay_status']=1; + $query = M("spend","tab_")->alias("s") + ->field("s.game_id,s.game_name,p.partner as partner_name, + SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END) as cash_count, + 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($map) + ->group('s.game_id'); + if ($row) { + $query = $query->page($page,$row); + } + $data = $query->select(); + return $data; + } + private function totalGameStatisticsData($map, $join = true) + { + $query = M("spend","tab_")->alias("s") + ->field("SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END) as cash_count, + 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"); + if ($join) { + $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, 'pay_game_status' => 1]) + ->where($map) + ->find(); + return $data; } } \ No newline at end of file diff --git a/Application/Admin/View/FinancePromote/gameStatistics.html b/Application/Admin/View/FinancePromote/gameStatistics.html new file mode 100644 index 000000000..96df32883 --- /dev/null +++ b/Application/Admin/View/FinancePromote/gameStatistics.html @@ -0,0 +1,448 @@ + + + + + + + + + + + +
+ + +
+ +
+ +
+
+ +
+
+ +
+
+ +  -  +
+ + +
+
+ + +
+ 搜索 + + 导出 +
+ + + +
+
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
合作公司游戏
游戏现金金额第三方支付(微信,支付宝,快捷)。
平台币直充支出平台币购买游戏道具所产生的金额
内充支出玩家用绑币购买游戏道具所产生的金额
游戏内充值合计游戏现金金额+平台币直充支出+平台币内充支出
操作
aOh! 暂时还没有内容!
{$data.partner_name}{$data.game_name}{$data.cash_count}0 + {$data.balance_coin_count}0{$data.inside_cash_count}0{$data.all_cash_count}0 + 查看 +
总计{$sumCash}0{$sumBalance}0{$sumInside}0{$sumAll}0 + 查看 +
+
+
+
+ + {$_page|default=''} +
+
+ + + + + + if(C('COLOR_STYLE')=='blue_color') echo ''; + + + + + + diff --git a/Application/Admin/View/FinancePromote/gameStatisticsDetail.html b/Application/Admin/View/FinancePromote/gameStatisticsDetail.html new file mode 100644 index 000000000..e214d9453 --- /dev/null +++ b/Application/Admin/View/FinancePromote/gameStatisticsDetail.html @@ -0,0 +1,327 @@ + + + + + + + + + + + +
+ + +
+ + +
+ 返回 +
+ + + + +
+   +
+
+ +   +
+
+ +   +
+
+ + - +
+ + +
+
+ +
+ +
+ +
+ + 搜索 + + 导出 + +
+
+
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
支付订单号充值时间玩家账号游戏名称所属推广员充值ip游戏区服角色名称订单金额实付金额充值方式
aOh! 暂时还没有内容!
{$data.pay_order_number}{$data.pay_time}{$data.user_account}{$data.game_name}{$data.promote_account}{$data.spend_ip}{$data.server_name}{$data.game_player_name}{$data.cost}{$data.pay_amount}{$data.pay_way}
总计累计充值:{$sumAll}0 + (现金金额:{$sumCash} 平台币:{$sumBalance} 绑币:{$sumInside}) +
+
+
+
+ + {$_page|default=''} +
+
+ + + + + + if(C('COLOR_STYLE')=='blue_color') echo ''; + + + + + + diff --git a/Application/Admin/View/FinancePromote/index.html b/Application/Admin/View/FinancePromote/index.html index 9855286e4..fe9982182 100644 --- a/Application/Admin/View/FinancePromote/index.html +++ b/Application/Admin/View/FinancePromote/index.html @@ -212,8 +212,7 @@ - 游戏查看 + 游戏查看 渠道查看 @@ -227,7 +226,7 @@ {$all_count['inside_cash_count']} {$all_count['all_count']} - 游戏查看 + 游戏查看 渠道查看 diff --git a/Application/Admin/View/FinancePromote/promoteUser.html b/Application/Admin/View/FinancePromote/promoteUser.html index 18b848aaf..b97665383 100644 --- a/Application/Admin/View/FinancePromote/promoteUser.html +++ b/Application/Admin/View/FinancePromote/promoteUser.html @@ -212,11 +212,7 @@ - 游戏查看 - 渠道查看 + 游戏查看 @@ -229,9 +225,8 @@ {$all_count['inside_cash_count']} {$all_count['all_count']} - 游戏查看 - 渠道查看 - + +