From 9cdab21db9d50e83526640220e8da281c915d669 Mon Sep 17 00:00:00 2001 From: yulingwei <2436953959@qq.com> Date: Fri, 31 Jul 2020 17:20:49 +0800 Subject: [PATCH 1/2] repair search --- .../Controller/ExportController.class.php | 94 ++++++++++++------- .../Controller/PlatformController.class.php | 8 ++ .../Admin/View/Platform/game_statistics.html | 12 ++- .../View/Platform/gamepay_statistics.html | 15 ++- 4 files changed, 89 insertions(+), 40 deletions(-) diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index f4babefd4..8c0ed2ba8 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -3196,6 +3196,10 @@ class ExportController extends Controller $map['tab_game.relation_game_id'] =$_REQUEST['game_id']; unset($_REQUEST['game_id']); } + if (!empty($_REQUEST['game_type'])) { + $map['tab_game.sdk_version'] = $_REQUEST['game_type']; + unset($_REQUEST['game_type']); + } $today = total(1); $week = total(2); $mounth = total(3); @@ -3276,47 +3280,66 @@ class ExportController extends Controller array('week', "本周充值"), array('mounth', "本月充值"), ); + $page = intval($p); $page = $page ? $page : 1; //默认显示第一页数据 - $arraypage=$page; - $row = 10; - $spend=M('Spend','tab_'); - $deposit = M('Deposit',"tab_"); - $map['game_id']=array('gt',0); - if(isset($_REQUEST['timestart'])&&isset($_REQUEST['timeend'])){ - $map['pay_time'] =array('BETWEEN',array(strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+24*60*60-1)); - unset($_REQUEST['timestart']);unset($_REQUEST['timeend']); + $arraypage = $page; + + if (isset($_REQUEST['row'])) { + $row = $_REQUEST['row']; + } else { + $row = 10; } - if(isset($_REQUEST['start'])&&isset($_REQUEST['end'])){ - $map['pay_time'] =array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1)); - unset($_REQUEST['start']);unset($_REQUEST['end']); + + $spend = M('Spend', 'tab_'); + $deposit = M('Deposit', "tab_"); + if (!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) { + $map['pay_time'] = ['between', array(strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399)]; + unset($_REQUEST['timestart']); + unset($_REQUEST['timeend']); + } elseif (!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) { + $map['pay_time'] = ['between', array(strtotime($_REQUEST['timestart']), time())]; + unset($_REQUEST['timestart']); + } elseif (empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) { + $map['pay_time'] = ['elt', strtotime($_REQUEST['timeend']) + 86399]; + unset($_REQUEST['timeend']); } - if(isset($_REQUEST['game_name'])&&$_REQUEST['game_name']!=''){ - $map['game_id'] =$_REQUEST['game_name']; - unset($_REQUEST['game_name']); + + //为数据权限添加 + setPowerPromoteIds($map); + + $map['game_id'] = array('gt', 0); + // var_dump($_REQUEST);exit; + if (isset($_REQUEST['game_id']) && $_REQUEST['game_id'] != '') { + $map['tab_game.relation_game_id'] = $_REQUEST['game_id']; + unset($_REQUEST['game_id']); + } + if (!empty($_REQUEST['game_type'])) { + $map['tab_spend.sdk_version'] = $_REQUEST['game_type']; + unset($_REQUEST['game_type']); } $map['tab_spend.pay_status'] = 1; $today = total(1); $week = total(2); $mounth = total(3); - $data = $spend ->field('tab_game.relation_game_name as game_name, tab_game.relation_game_id as game_id,date_format(FROM_UNIXTIME(pay_time),"%Y-%m-%d") AS time, sum(pay_amount) as count') ->where($map) - ->join('tab_game on tab_game.id = tab_spend.game_id', 'left') ->where($map) + ->join('tab_game on tab_game.id = tab_spend.game_id', 'left') ->group('tab_game.relation_game_id') ->order('count desc,pay_time') ->select(); + //今日、本周、本月不随搜索条件而变动 $map2['tab_spend.pay_status'] = 1; $map2['game_id'] = array('gt', 0); setPowerPromoteIds($map2); $data2 = $spend - ->field('tab_game.relation_game_id as game_id,sum(IF(pay_time ' . $today . ',pay_amount,0)) as today, - sum(IF(pay_time ' . $week . ',pay_amount,0)) as week, + ->field('tab_game.relation_game_id as game_id, sum(IF(pay_time ' . $today . ',pay_amount,0)) as today, + sum(IF(pay_time ' . $week . ',pay_amount,0)) as week, sum(IF(pay_time ' . $mounth . ',pay_amount,0)) as mounth') - ->join('tab_game on tab_game.id = tab_spend.game_id', 'left') + ->join('tab_game on tab_game.id = tab_spend.game_id', 'left') ->where($map2) ->group('tab_game.relation_game_id') ->select(); @@ -3331,24 +3354,27 @@ class ExportController extends Controller $data[$key]['week'] = $data2[$value['game_id']]['week']; $data[$key]['mounth'] = $data2[$value['game_id']]['mounth']; } - $total=A('Platform')->data_total($data); - $this->assign('total',$total); - if($_REQUEST['data_order']!=''){ - $data_order=reset(explode(',',$_REQUEST['data_order'])); - $data_order_type=end(explode(',',$_REQUEST['data_order'])); - $this->assign('userarpu_order',$data_order); - $this->assign('userarpu_order_type',$data_order_type); + $total = $this->data_total($data); + $this->assign('total', $total); + if ($_REQUEST['data_order'] != '') { + $data_order = reset(explode(',', $_REQUEST['data_order'])); + $data_order_type = end(explode(',', $_REQUEST['data_order'])); + $this->assign('userarpu_order', $data_order); + $this->assign('userarpu_order_type', $data_order_type); } - if($count > $row){ - $page = new \Think\Page($count, $row); - $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%'); - $this->assign('_page', $page->show()); + + + $page = set_pagination($count, $row); + if ($page) { + $this->assign('_page', $page); } - $data=my_sort($data,$data_order_type,(int)$data_order); - $size=$row;//每页显示的记录数 - $pnum = ceil(count($data) / $size); //总页数,ceil()函数用于求大于数字的最小整数 + + //$this->checkListOrCountAuthRestMap($map,[]); + + $data = my_sort($data, $data_order_type, (int)$data_order); + $size = $row;//每页显示的记录数 + //$pnum = ceil(count($data) / $size); //总页数,ceil()函数用于求大于数字的最小整数 //用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度) -// $data = array_slice($data, ($arraypage-1)*$size, $size); $length = count($data); $data[$length] = array( 'game_name'=>'汇总', diff --git a/Application/Admin/Controller/PlatformController.class.php b/Application/Admin/Controller/PlatformController.class.php index 1cf325e77..e96f6ba59 100644 --- a/Application/Admin/Controller/PlatformController.class.php +++ b/Application/Admin/Controller/PlatformController.class.php @@ -45,6 +45,10 @@ class PlatformController extends ThinkController unset($_REQUEST['game_id']); } + if (!empty($_REQUEST['game_type'])) { + $map['tab_game.sdk_version'] = $_REQUEST['game_type']; + } + $today = total(1); $week = total(2); $mounth = total(3); @@ -149,6 +153,10 @@ class PlatformController extends ThinkController $map['tab_game.relation_game_id'] = $_REQUEST['game_id']; unset($_REQUEST['game_id']); } + if (!empty($_REQUEST['game_type'])) { + $map['tab_spend.sdk_version'] = $_REQUEST['game_type']; + unset($_REQUEST['game_type']); + } $map['tab_spend.pay_status'] = 1; $today = total(1); $week = total(2); diff --git a/Application/Admin/View/Platform/game_statistics.html b/Application/Admin/View/Platform/game_statistics.html index 759059d82..b5707b940 100644 --- a/Application/Admin/View/Platform/game_statistics.html +++ b/Application/Admin/View/Platform/game_statistics.html @@ -60,11 +60,18 @@
+
+ +
搜索 @@ -167,6 +174,7 @@ 'timestart'=>$_GET['timestart'], 'timeend'=>$_GET['timeend'], 'game_id'=>$_GET['game_id'], + 'game_type'=>$_GET['game_type'], 'p'=>$_GET['p'], 'xlsname'=>'统计_平台统计_游戏注册统计', ), diff --git a/Application/Admin/View/Platform/gamepay_statistics.html b/Application/Admin/View/Platform/gamepay_statistics.html index f41310f13..3b0661b3c 100644 --- a/Application/Admin/View/Platform/gamepay_statistics.html +++ b/Application/Admin/View/Platform/gamepay_statistics.html @@ -56,13 +56,20 @@
- - - + +
+
+ +
搜索 @@ -136,7 +143,7 @@
导出 {$_page|default=''} From 8d36e35271c4e40c565b83c8c8c3d3b2100b00d1 Mon Sep 17 00:00:00 2001 From: yulingwei <2436953959@qq.com> Date: Fri, 31 Jul 2020 18:15:12 +0800 Subject: [PATCH 2/2] upt --- .../Controller/ExportController.class.php | 95 ++++++++++++------- .../Controller/PlatformController.class.php | 22 ++++- 2 files changed, 81 insertions(+), 36 deletions(-) diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index 8c0ed2ba8..997f21507 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -3171,15 +3171,25 @@ class ExportController extends Controller array('week', "本周注册"), array('mounth', "本月注册"), ); + $page = intval($p); $page = $page ? $page : 1; //默认显示第一页数据 - $arraypage=$page; - $row = 10; - $user=M('User','tab_'); - $map['fgame_id']=array('egt',0);$map['puid'] = 0; - if(isset($_REQUEST['timestart'])&&isset($_REQUEST['timeend'])){ - $map['register_time'] =array('BETWEEN',array(strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+24*60*60-1)); - unset($_REQUEST['timestart']);unset($_REQUEST['timeend']); + $arraypage = $page; + + if (isset($_REQUEST['row'])) { + $row = $_REQUEST['row']; + } else { + $row = 10; + } + + $user = M('User', 'tab_'); + $map['fgame_id'] = array('egt', 0); + $map['puid'] = 0; + + if (!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) { + $map['register_time'] = ['between', array(strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399)]; + unset($_REQUEST['timestart']); + unset($_REQUEST['timeend']); } elseif (!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) { $map['register_time'] = ['between', array(strtotime($_REQUEST['timestart']), time())]; unset($_REQUEST['timestart']); @@ -3188,18 +3198,15 @@ class ExportController extends Controller unset($_REQUEST['timeend']); } - if(isset($_REQUEST['start'])&&isset($_REQUEST['end'])){ - $map['register_time'] =array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1)); - unset($_REQUEST['start']);unset($_REQUEST['end']); - } - if(isset($_REQUEST['game_id'])&&$_REQUEST['game_id']!=''){ - $map['tab_game.relation_game_id'] =$_REQUEST['game_id']; - unset($_REQUEST['game_id']); + // var_dump($_REQUEST);exit; + if (isset($_REQUEST['game_id']) && $_REQUEST['game_id'] != '') { + $map['tab_game.relation_game_id'] = $_REQUEST['game_id']; } + if (!empty($_REQUEST['game_type'])) { $map['tab_game.sdk_version'] = $_REQUEST['game_type']; - unset($_REQUEST['game_type']); } + $today = total(1); $week = total(2); $mounth = total(3); @@ -3207,26 +3214,32 @@ class ExportController extends Controller setPowerPromoteIds($map); $data = $user ->field('tab_game.relation_game_id,tab_game.relation_game_name,date_format(FROM_UNIXTIME( register_time),"%Y-%m-%d") AS time, count(tab_user.id) as count') - ->join('tab_game on tab_game.id = fgame_id', 'left') ->where($map) + ->join('tab_game on tab_game.id = fgame_id', 'left') ->group('tab_game.relation_game_id') ->order('count desc,register_time') ->select(); -// dd($data); $map2 = array(); - $map['fgame_id'] = array('egt', 0); - $map['puid'] = 0; + $map2['fgame_id'] = array('egt', 0); + $map2['puid'] = 0; + + if (isset($_REQUEST['game_id']) && $_REQUEST['game_id'] != '') { + $map2['tab_game.relation_game_id'] = $_REQUEST['game_id']; + } + + if (!empty($_REQUEST['game_type'])) { + $map2['tab_game.sdk_version'] = $_REQUEST['game_type']; + } setPowerPromoteIds($map2); $data2 = $user->field('tab_game.relation_game_id,count(IF(register_time ' . $today . ',1,null)) as today, - count(IF(register_time ' . $week . ',1,null)) as week, - count(IF(register_time ' . $mounth . ',1,null)) as mounth') - ->join('tab_game on tab_game.id = fgame_id', 'left') + count(IF(register_time ' . $week . ',1,null)) as week, + count(IF(register_time ' . $mounth . ',1,null)) as mounth') ->where($map2) + ->join('tab_game on tab_game.id = fgame_id', 'left') ->group('tab_game.relation_game_id') ->select(); $data2 = array_column($data2, null, 'relation_game_id'); -// dd($data2); $count = count($data); foreach ($data as $key => $value) { static $i = 0; @@ -3240,15 +3253,23 @@ class ExportController extends Controller $data[$key]['week'] = $data2[$value['relation_game_id']]['week']; $data[$key]['mounth'] = $data2[$value['relation_game_id']]['mounth']; } - $total=A('Platform')->data_total($data); - if($_REQUEST['data_order']!=''){ - $data_order=reset(explode(',',$_REQUEST['data_order'])); - $data_order_type=end(explode(',',$_REQUEST['data_order'])); - $this->assign('userarpu_order',$data_order); - $this->assign('userarpu_order_type',$data_order_type); + + $total = $this->data_total($data); + $this->assign('total', $total); + if ($_REQUEST['data_order'] != '') { + $data_order = reset(explode(',', $_REQUEST['data_order'])); + $data_order_type = end(explode(',', $_REQUEST['data_order'])); + $this->assign('userarpu_order', $data_order); + $this->assign('userarpu_order_type', $data_order_type); } - $data=my_sort($data,$data_order_type,(int)$data_order); - $size=$row;//每页显示的记录数 + + $page = set_pagination($count, $row); + if ($page) { + $this->assign('_page', $page); + } + + $data = my_sort($data, $data_order_type, (int)$data_order); + $size = $row;//每页显示的记录数 $pnum = ceil(count($data) / $size); //总页数,ceil()函数用于求大于数字的最小整数 //用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度) // $data = array_slice($data, ($arraypage-1)*$size, $size); @@ -3312,11 +3333,11 @@ class ExportController extends Controller // var_dump($_REQUEST);exit; if (isset($_REQUEST['game_id']) && $_REQUEST['game_id'] != '') { $map['tab_game.relation_game_id'] = $_REQUEST['game_id']; - unset($_REQUEST['game_id']); + //unset($_REQUEST['game_id']); } if (!empty($_REQUEST['game_type'])) { $map['tab_spend.sdk_version'] = $_REQUEST['game_type']; - unset($_REQUEST['game_type']); + //unset($_REQUEST['game_type']); } $map['tab_spend.pay_status'] = 1; $today = total(1); @@ -3334,6 +3355,14 @@ class ExportController extends Controller //今日、本周、本月不随搜索条件而变动 $map2['tab_spend.pay_status'] = 1; $map2['game_id'] = array('gt', 0); + if (isset($_REQUEST['game_id']) && $_REQUEST['game_id'] != '') { + $map2['tab_game.relation_game_id'] = $_REQUEST['game_id']; + //unset($_REQUEST['game_id']); + } + if (!empty($_REQUEST['game_type'])) { + $map2['tab_spend.sdk_version'] = $_REQUEST['game_type']; + //unset($_REQUEST['game_type']); + } setPowerPromoteIds($map2); $data2 = $spend ->field('tab_game.relation_game_id as game_id, sum(IF(pay_time ' . $today . ',pay_amount,0)) as today, diff --git a/Application/Admin/Controller/PlatformController.class.php b/Application/Admin/Controller/PlatformController.class.php index e96f6ba59..712ad29a5 100644 --- a/Application/Admin/Controller/PlatformController.class.php +++ b/Application/Admin/Controller/PlatformController.class.php @@ -42,7 +42,6 @@ class PlatformController extends ThinkController // var_dump($_REQUEST);exit; if (isset($_REQUEST['game_id']) && $_REQUEST['game_id'] != '') { $map['tab_game.relation_game_id'] = $_REQUEST['game_id']; - unset($_REQUEST['game_id']); } if (!empty($_REQUEST['game_type'])) { @@ -64,6 +63,14 @@ class PlatformController extends ThinkController $map2 = array(); $map2['fgame_id'] = array('egt', 0); $map2['puid'] = 0; + + if (isset($_REQUEST['game_id']) && $_REQUEST['game_id'] != '') { + $map2['tab_game.relation_game_id'] = $_REQUEST['game_id']; + } + + if (!empty($_REQUEST['game_type'])) { + $map2['tab_game.sdk_version'] = $_REQUEST['game_type']; + } setPowerPromoteIds($map2); $data2 = $user->field('tab_game.relation_game_id,count(IF(register_time ' . $today . ',1,null)) as today, @@ -151,11 +158,11 @@ class PlatformController extends ThinkController // var_dump($_REQUEST);exit; if (isset($_REQUEST['game_id']) && $_REQUEST['game_id'] != '') { $map['tab_game.relation_game_id'] = $_REQUEST['game_id']; - unset($_REQUEST['game_id']); + //unset($_REQUEST['game_id']); } if (!empty($_REQUEST['game_type'])) { $map['tab_spend.sdk_version'] = $_REQUEST['game_type']; - unset($_REQUEST['game_type']); + //unset($_REQUEST['game_type']); } $map['tab_spend.pay_status'] = 1; $today = total(1); @@ -173,6 +180,15 @@ class PlatformController extends ThinkController //今日、本周、本月不随搜索条件而变动 $map2['tab_spend.pay_status'] = 1; $map2['game_id'] = array('gt', 0); + // var_dump($_REQUEST);exit; + if (isset($_REQUEST['game_id']) && $_REQUEST['game_id'] != '') { + $map2['tab_game.relation_game_id'] = $_REQUEST['game_id']; + //unset($_REQUEST['game_id']); + } + if (!empty($_REQUEST['game_type'])) { + $map2['tab_spend.sdk_version'] = $_REQUEST['game_type']; + //unset($_REQUEST['game_type']); + } setPowerPromoteIds($map2); $data2 = $spend ->field('tab_game.relation_game_id as game_id, sum(IF(pay_time ' . $today . ',pay_amount,0)) as today,