From cbbbf6350cbc6dd414c3f43b6e359538c61bf045 Mon Sep 17 00:00:00 2001 From: zhanglingsheng Date: Tue, 17 Dec 2019 21:01:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AD=BE=E7=BB=9F=E8=AE=A1--?= =?UTF-8?q?=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/ExportController.class.php | 103 ++++++++++++++++++ .../SuperStatisticalController.class.php | 48 ++++---- .../Admin/View/SuperStatistical/index.html | 3 + .../Admin/View/SuperStatistical/lists.html | 9 +- .../View/SuperStatistical/superDetail.html | 1 + 5 files changed, 133 insertions(+), 31 deletions(-) diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index 683ded289..77ee795e0 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -1864,6 +1864,109 @@ class ExportController extends Controller } $xlsData = $data; break; + case 22: + $xlsCell = array( + array('game_name', '游戏'), + array('authorization_num', '已授权游戏数量'), + array('pay_game_supersign', '超级签被购买数量'), + array('promote_super_money', '推广超级签金额'), + array('official_super_money', '官方超级签金额'), + ); + $map['supersign_token'] = ['NEQ','']; + $supersign_game = M('game', 'tab_')->field('id,game_name,supersign_token')->where($map)->select(); + $xlsData = []; + $count['authorization'] = 0; + $count['pay_num'] = 0; + $count['promote_super_money'] = 0; + $count['official_super_money'] = 0; + foreach($supersign_game as $k => $v) { + $arr['game_name'] = $v['game_name']; + $re_data = []; + $curl['token'] = $v['token']; + $curl['limit'] = 2000; + for ($i = 1;$i > 0;$i++) { + if($i != 1) { + $pop = array_pop($data); + $curl['lastid'] = $pop['id']; + } + $curl_re = json_decode(curl_post('https://app.ipa365.com/Kirin/OpenApi/TicketList',$curl),true); + if($curl_re['errno'] == 0) { + $data = $curl_re['data']['list']; + $re_data = array_merge($re_data,$data); + } else { + break; + } + if(count($data) != $curl['limit']) { + break; + } + } + $arr['authorization_num'] = count($re_data); + $game_supersign = M('game_supersign', 'tab_')->field('promote_id')->join('tab_user on tab_game_supersign.user_id = tab_user.id')->where(['game_id' => $v['id'], 'pay_status' => 1])->select(); + $arr['pay_game_supersign'] = count($game_supersign); + $arr['promote_super_money'] = 0; + $arr['official_super_money'] = 0; + foreach($game_supersign as $key => $val) { + if($val['promote_id'] != 0) { + $arr['promote_super_money'] += 10; + }else { + $arr['official_super_money'] += 10; + } + } + $xlsData[] = $arr; + } + break; + case 23: + $xlsCell = array( + array('order_id', '订单号'), + array('account', '游戏账号'), + array('promote_account', '所属推广员'), + array('device_number', '设备号'), + array('game_name', '游戏'), + array('pay_time', '购买时间'), + array('super_money', '超级签金额'), + ); + $xlsData = M('game_supersign', 'tab_')->field('tab_game_supersign.id,tab_game_supersign.order_id,tab_user.account,tab_user.promote_account,tab_user.device_number,tab_game.game_name,tab_game_supersign.pay_time')->join('tab_user on tab_game_supersign.user_id = tab_user.id')->join('tab_game on tab_game_supersign.game_id = tab_game.id')->where(['tab_game_supersign.pay_status' => 1])->order('id DESC')->select(); + foreach($xlsData as $k => $v) { + $xlsData[$k]['pay_time'] = date('Y-m-d H:i:s',$v['pay_time']); + } + break; + case 24: + $xlsCell = array( + array('authorization_all_num', '已授权游戏总数'), + array('buy_num', '超级签被购买数量'), + array('money_all', '超级签金额合计'), + ); + $map['supersign_token'] = ['NEQ','']; + $supersign_game = M('game', 'tab_')->field('supersign_token')->where($map)->select(); + $supersign_token = array_column($supersign_game, 'supersign_token'); + $authorization_all_num = 0; + foreach($supersign_token as $k => $v) { + $re_data = []; + $curl['token'] = $v; + $curl['limit'] = 2000; + for ($i = 1;$i > 0;$i++) { + if($i != 1) { + $pop = array_pop($data); + $curl['lastid'] = $pop['id']; + } + $curl_re = json_decode(curl_post('https://app.ipa365.com/Kirin/OpenApi/TicketList',$curl),true); + if($curl_re['errno'] == 0) { + $data = $curl_re['data']['list']; + $re_data = array_merge($re_data,$data); + } else { + break; + } + if(count($data) != $curl['limit']) { + break; + } + } + $authorization_all_num += count($re_data); + } + $where['pay_status'] = 1; + $xlsData[0]['buy_num'] = M('game_supersign', 'tab_')->where($where)->count(); + $xlsData[0]['money_all'] = $xlsData[0]['buy_num'] * 10; + $xlsData[0]['authorization_all_num'] = $authorization_all_num; + break; default: $xlsName = $xlsCell = $xlsData = []; diff --git a/Application/Admin/Controller/SuperStatisticalController.class.php b/Application/Admin/Controller/SuperStatisticalController.class.php index 8d3b22fd0..a2bfc3b93 100644 --- a/Application/Admin/Controller/SuperStatisticalController.class.php +++ b/Application/Admin/Controller/SuperStatisticalController.class.php @@ -37,21 +37,23 @@ class SuperStatisticalController extends ThinkController $this->display('index'); } - public function lists() { + public function lists($p = 1,$row = 10) { + $page = $p ? $p : 1; + $row = $row ? $row : 10; $map['supersign_token'] = ['NEQ','']; - $supersign_game = M('game', 'tab_')->field('id,game_name,supersign_token')->where($map)->select(); + $supersign_game = M('game', 'tab_')->field('id,game_name,supersign_token')->where($map)->page($page,$row)->select(); $data = []; - $count['authorization'] = 0; - $count['pay_num'] = 0; - $count['promote_super_money'] = 0; - $count['official_super_money'] = 0; + $num['authorization'] = 0; + $num['pay_num'] = 0; + $num['promote_super_money'] = 0; + $num['official_super_money'] = 0; foreach($supersign_game as $k => $v) { $arr['game_name'] = $v['game_name']; $arr['authorization_num'] = count($this->game_supersign_num($v['supersign_token'])); - $count['authorization'] += $arr['authorization_num']; + $num['authorization'] += $arr['authorization_num']; $game_supersign = M('game_supersign', 'tab_')->field('promote_id')->join('tab_user on tab_game_supersign.user_id = tab_user.id')->where(['game_id' => $v['id'], 'pay_status' => 1])->select(); $arr['pay_game_supersign'] = count($game_supersign); - $count['pay_num'] += $arr['pay_game_supersign']; + $num['pay_num'] += $arr['pay_game_supersign']; $arr['promote_super_money'] = 0; $arr['official_super_money'] = 0; @@ -62,12 +64,15 @@ class SuperStatisticalController extends ThinkController $arr['official_super_money'] += $this->super_money; } } - $count['official_super_money'] += $arr['official_super_money']; - $count['promote_super_money'] += $arr['promote_super_money']; + $num['official_super_money'] += $arr['official_super_money']; + $num['promote_super_money'] += $arr['promote_super_money']; $data[] = $arr; } + $count = M('game', 'tab_')->where($map)->count(); + $page = set_pagination($count, $row); + $this->assign('_page', $page); $this->assign('data', $data); - $this->assign('count', $count); + $this->assign('num', $num); $this->display('lists'); } @@ -94,26 +99,15 @@ class SuperStatisticalController extends ThinkController return $re_data; } - public function superDetail() { - - $page = intval($p); - $page = $page ? $page : 1; //默认显示第一页数据 - $row = 10; - - if (isset($_REQUEST['row'])) { - $row = $_REQUEST['row']; - } else { - $row = 10; - } - - $data = M('game_supersign', 'tab_')->field('tab_game_supersign.order_id,tab_user.account,tab_user.promote_account,tab_user.device_number,tab_game.game_name,tab_game_supersign.pay_time')->join('tab_user on tab_game_supersign.user_id = tab_user.id')->join('tab_game on tab_game_supersign.game_id = tab_game.id')->where(['tab_game_supersign.pay_status' => 1])->page($page,$row)->select(); + public function superDetail($p = 1,$row = 10) { + $page = $p ? $p : 1; + $row = $row ? $row : 10; + $data = M('game_supersign', 'tab_')->field('tab_game_supersign.id,tab_game_supersign.order_id,tab_user.account,tab_user.promote_account,tab_user.device_number,tab_game.game_name,tab_game_supersign.pay_time')->join('tab_user on tab_game_supersign.user_id = tab_user.id')->join('tab_game on tab_game_supersign.game_id = tab_game.id')->where(['tab_game_supersign.pay_status' => 1])->page($page,$row)->order('id DESC')->select(); $count = M('game_supersign', 'tab_')->field('tab_game_supersign.order_id,tab_user.account,tab_user.promote_account,tab_user.device_number,tab_game.game_name,tab_game_supersign.pay_time')->join('tab_user on tab_game_supersign.user_id = tab_user.id')->join('tab_game on tab_game_supersign.game_id = tab_game.id')->where(['tab_game_supersign.pay_status' => 1])->count(); $super_money_all = $count * $this->super_money; $page = set_pagination($count, $row); - if ($page) { - $this->assign('_page', $page); - } + $this->assign('_page', $page); $this->assign('data', $data); $this->assign('super_money', $this->super_money); $this->assign('super_money_all', $super_money_all); diff --git a/Application/Admin/View/SuperStatistical/index.html b/Application/Admin/View/SuperStatistical/index.html index 997feb503..ae5a003df 100644 --- a/Application/Admin/View/SuperStatistical/index.html +++ b/Application/Admin/View/SuperStatistical/index.html @@ -63,6 +63,9 @@ 搜索 +
+ 导出 +
diff --git a/Application/Admin/View/SuperStatistical/lists.html b/Application/Admin/View/SuperStatistical/lists.html index 950af61bc..7d3bf6524 100644 --- a/Application/Admin/View/SuperStatistical/lists.html +++ b/Application/Admin/View/SuperStatistical/lists.html @@ -53,16 +53,17 @@ 合计 - {$count.authorization} - {$count.pay_num} - {$count.promote_super_money} - {$count.official_super_money} + {$num.authorization} + {$num.pay_num} + {$num.promote_super_money} + {$num.official_super_money}
+ 导出 {$_page|default=''}
diff --git a/Application/Admin/View/SuperStatistical/superDetail.html b/Application/Admin/View/SuperStatistical/superDetail.html index 228bc8b42..f1c5a3f59 100644 --- a/Application/Admin/View/SuperStatistical/superDetail.html +++ b/Application/Admin/View/SuperStatistical/superDetail.html @@ -69,6 +69,7 @@
+ 导出 {$_page|default=''}