diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 2226b29c3..1fd6cddc8 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -46,42 +46,42 @@ class QueryController extends BaseController // $map['tab_spend.promote_id'] = ['in', $childPromoteIds]; // } - - $map1['chain'] = ['like','%'.PID.'/'.'%']; - $rs = M('promote','tab_')->where($map1)->field('id,account,nickname')->select(); + + $map1['chain'] = ['like', '%' . PID . '/' . '%']; + $rs = M('promote', 'tab_')->where($map1)->field('id,account,nickname')->select(); $childPromoteIds = ''; - if(empty($rs)) { + if (empty($rs)) { $map['tab_spend.promote_id'] = PID; - }else { - foreach ($rs as $rsKey => $rsValue) { + } else { + foreach ($rs as $rsKey => $rsValue) { $id = $rsValue['id']; - $childPromoteIds .= $id.','; + $childPromoteIds .= $id . ','; } - $childPromoteIds = rtrim($childPromoteIds, ','); - $childPromoteIds .= ',' . PID; - $map['tab_spend.promote_id'] = ['in', $childPromoteIds]; + $childPromoteIds = rtrim($childPromoteIds, ','); + $childPromoteIds .= ',' . PID; + $map['tab_spend.promote_id'] = ['in', $childPromoteIds]; } $levelPromote = I('level_promote', []); - $promote = $this->getLoginPromote(); + $promote = $this->getLoginPromote(); $queryPromote = $this->getQueryPromote($levelPromote); - $map2['chain'] = ['like', $queryPromote['chain'].$queryPromote['id'].'/%']; + $map2['chain'] = ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%']; $ids = M('promote', 'tab_')->where($map2)->getField('id', true); - if(empty($ids)) { - $ids = array(); + if (empty($ids)) { + $ids = array(); } - if(empty($levelPromote)) { - array_push($ids,PID); - + if (empty($levelPromote)) { + array_push($ids, PID); + } - array_push($ids,$queryPromote['id']); + array_push($ids, $queryPromote['id']); if (!empty($ids)) { - $map['tab_spend.promote_id'] = ['in',$ids]; - - }else { + $map['tab_spend.promote_id'] = ['in', $ids]; + + } else { $map['_string'] = '1<>1'; } - + if (!empty(I('own_id'))) { $map['tab_spend.promote_id'] = $promote['id'];//本账号 @@ -201,42 +201,42 @@ class QueryController extends BaseController // // $map['tab_user.promote_id'] = ['in', $childPromoteIds]; // } - // $map['tab_user.promote_id'] = ['like','%'.PID.'/'.'%']; - $map1['chain'] = ['like','%'.PID.'/'.'%']; - $rs = M('promote','tab_')->where($map1)->field('id,account,nickname')->select(); + // $map['tab_user.promote_id'] = ['like','%'.PID.'/'.'%']; + $map1['chain'] = ['like', '%' . PID . '/' . '%']; + $rs = M('promote', 'tab_')->where($map1)->field('id,account,nickname')->select(); $childPromoteIds = ''; - if(empty($rs)) { + if (empty($rs)) { $map['tab_user.promote_id'] = PID; - }else { - foreach ($rs as $rsKey => $rsValue) { + } else { + foreach ($rs as $rsKey => $rsValue) { $id = $rsValue['id']; - $childPromoteIds .= $id.','; + $childPromoteIds .= $id . ','; } - $childPromoteIds = rtrim($childPromoteIds, ','); - $childPromoteIds .= ',' . PID; - $map['tab_user.promote_id'] = ['in', $childPromoteIds]; + $childPromoteIds = rtrim($childPromoteIds, ','); + $childPromoteIds .= ',' . PID; + $map['tab_user.promote_id'] = ['in', $childPromoteIds]; } $levelPromote = I('level_promote', []); - $promote = $this->getLoginPromote(); + $promote = $this->getLoginPromote(); $queryPromote = $this->getQueryPromote($levelPromote); - $map2['chain'] = ['like', $queryPromote['chain'].$queryPromote['id'].'/%']; + $map2['chain'] = ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%']; $ids = M('promote', 'tab_')->where($map2)->getField('id', true); - if(empty($ids)) { - $ids = array(); + if (empty($ids)) { + $ids = array(); } - if(empty($levelPromote)) { - array_push($ids,PID); - + if (empty($levelPromote)) { + array_push($ids, PID); + } - array_push($ids,$queryPromote['id']); + array_push($ids, $queryPromote['id']); if (!empty($ids)) { - $map['tab_user.promote_id'] = ['in',$ids]; - - }else { + $map['tab_user.promote_id'] = ['in', $ids]; + + } else { $map['_string'] = '1<>1'; } - + if (!empty(I('own_id'))) { $map['tab_user.promote_id'] = $promote['id'];//本账号 } @@ -1062,7 +1062,7 @@ class QueryController extends BaseController $initEndTime = empty(I('endtime')) ? $initEndTime : I('endtime'); $begTime = strtotime($initBegTime); $endTime = strtotime($initEndTime); - $levelPromote = I('level_promote', []); + $levelPromote = $this->getLevelPromote(); $queryPromote = $this->getQueryPromote($levelPromote); $loginPromote = $this->getLoginPromote(); @@ -1302,6 +1302,9 @@ class QueryController extends BaseController public function summary() { + $page = intval(I('get.p', 1)); + $page = $page ? $page : 1; //默认显示第一页数据arraypage + $row = intval(I('get.row', 10)); $relationGameId = intval(I('relation_game_id', 0)); $sdkVersion = intval(I('sdk_version', 0)); $serverId = intval(I('server_id'), 0); @@ -1312,9 +1315,20 @@ class QueryController extends BaseController $initEndTime = empty(I('endtime')) ? $initEndTime : I('endtime'); $begTime = strtotime($initBegTime); $endTime = strtotime($initEndTime); - $levelPromote = I('level_promote', []); + $levelPromote = $this->getLevelPromote(); $queryPromote = $this->getQueryPromote($levelPromote); + empty($relationGameId) || $parameter['relation_game_id'] = $relationGameId; + empty($sdkVersion) || $parameter['sdk_version'] = $sdkVersion; + empty($serverId) || $parameter['server_id'] = $serverId; + $parameter['level_promote_2'] = $levelPromote[0]; + $parameter['level_promote_3'] = $levelPromote[1]; + $parameter['level_promote_4'] = $levelPromote[2]; + $parameter['begtime'] = $initBegTime; + $parameter['endtime'] = $initEndTime; + $parameter['p'] = $page; + $parameter['row'] = $row; + $loginPromote = $this->getLoginPromote(); $map = []; @@ -1359,14 +1373,20 @@ class QueryController extends BaseController $userGameLoginModel = M('UserGameLoginRecord', 'tab_'); $spendModel = M('Spend', 'tab_'); - $query = M('Apply', 'tab_')->alias('a') + $data = M('Apply', 'tab_')->alias('a') ->field('a.game_id,a.game_name,a.sdk_version') ->join('tab_game as g on g.id = a.game_id') ->join($serverJoin) ->where($map) ->group('a.game_id') - ->order('g.sort desc,g.id desc'); - list($records, $pagination, $count) = $this->paginate($query); + ->order('g.sort desc,g.id desc') + ->page($page, $row) + ->select(); + $count = M('Apply', 'tab_')->alias('a') + ->join('tab_game as g on g.id = a.game_id') + ->join($serverJoin) + ->where($map) + ->count('distinct a.game_id'); $allData['role_num'] = 0; $allData['user_num'] = 0; @@ -1382,8 +1402,8 @@ class QueryController extends BaseController $allData['pay_amount'] = 0; $allData['spend_discount'] = 0; $allData['spend_voucher'] = 0; - if (!empty($records)) { - foreach ($records as &$list) { + if (!empty($data)) { + foreach ($data as &$list) { $userPlayInfoMap['tab_user_play_info.game_id'] = $list['game_id']; $userPlayInfoMap2['tab_user_play_info.game_id'] = $list['game_id']; $userGameLoginMap['tab_user_game_login_record.game_id'] = $list['game_id']; @@ -1478,12 +1498,15 @@ class QueryController extends BaseController $serverData = $this->getServer($relationGameId, $sdkVersion); + $page = set_pagination($count, $row, $parameter); + if ($page) { + $this->assign('_page', $page); + } $this->assign('meta_title', '数据汇总列表'); $this->assign('loginPromote', $loginPromote); $this->assign('ownId', $ownId); $this->assign('allData', $allData); - $this->assign('listData', $records); - $this->assign('pagination', $pagination); + $this->assign('listData', $data); $this->assign('count', $count); $this->assign('setdate', date("Y-m-d")); $this->assign('initBegTime', $initBegTime); diff --git a/Application/Home/View/default/Apply/index.html b/Application/Home/View/default/Apply/index.html index 1997e6726..9f1986d7c 100644 --- a/Application/Home/View/default/Apply/index.html +++ b/Application/Home/View/default/Apply/index.html @@ -470,8 +470,9 @@ }); } + $('#promote_id').empty(); $('#promote_id').html(html); - $('#promote_id').val(); + $('#promote_id').select2(); }, error: function (result) { layer.msg('网络异常', {icon: 5}); diff --git a/Application/Home/View/default/Apply/my_game.html b/Application/Home/View/default/Apply/my_game.html index 3ea495410..3d76bbbcc 100644 --- a/Application/Home/View/default/Apply/my_game.html +++ b/Application/Home/View/default/Apply/my_game.html @@ -571,8 +571,9 @@ }); } + $('#promote_id').empty(); $('#promote_id').html(html); - $('#promote_id').val(); + $('#promote_id').select2(); }, error: function (result) { layer.msg('网络异常', {icon: 5}); diff --git a/Application/Home/View/default/Query/summary.html b/Application/Home/View/default/Query/summary.html index 4ff14f3e4..5f9d5539b 100644 --- a/Application/Home/View/default/Query/summary.html +++ b/Application/Home/View/default/Query/summary.html @@ -208,7 +208,7 @@
- {$pagination} + {$_page}