From 1a110770dc0db7f8643ee80bfe29d97a25cbe138 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Thu, 21 Nov 2019 21:32:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=B9=B3=E5=8F=B0->=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=B1=87=E6=80=BB->=E5=85=85=E5=80=BC=E7=8E=A9?= =?UTF-8?q?=E5=AE=B6--=E6=B7=BB=E5=8A=A0=E6=8E=92=E5=BA=8F=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/Controller/QueryController.class.php | 61 ++++++++++++++----- .../View/default/Query/userRecharges.html | 11 ++-- 2 files changed, 53 insertions(+), 19 deletions(-) diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 2958e383d..10497e702 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -1712,8 +1712,10 @@ class QueryController extends BaseController $sdkVersion = I('sdk_version', 0); $costBegin = I('cost_begin', ''); $costEnd = I('cost_end', ''); + $lastSortName = trim(I('last_sort_name', '')); $sortName = trim(I('sort_name', '')); $sort = intval(I('sort', 1)); + $sortNameData = ['recharge_cost', 'recharge_count', 'recharge_cost_today', 'unlogin_day']; $nowTime = date('Y-m-d'); $initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime))); $initBegTime = empty(I('begtime')) ? $initBegTime : I('begtime'); @@ -1784,8 +1786,32 @@ class QueryController extends BaseController ->buildSql(); $map['_string'] = 'role_id in (' . $subQuery . ')'; } + + $orderBy = 'play_time desc'; + if (!empty($sortName)) { + if (in_array($sortName, $sortNameData)) { + $desc = ' desc'; + $asc = ' asc'; + if ($sortName == 'unlogin_day') { + $sortName = 'play_time'; + $desc = ' asc'; + $asc = ' desc'; + } + if ($lastSortName == 'unlogin_day') { + $lastSortName = 'play_time'; + } + if ($lastSortName != $sortName) { + $sortString = $desc; + $sort = 1; + } else { + $sortString = ($sort == 1) ? $desc : $asc; + } + $orderBy = $sortName . $sortString; + } + } + $spendMap['uc.create_time'] = ['between', [$begTime, $endTime - 1]]; - $spendMap['_string'] = 'uc.game_id = game_id and uc.server_id = server_id and uc.role_id = role_id'; + $spendMap['_string'] = 'uc.game_id = tab_user_play_info.game_id and uc.server_id = tab_user_play_info.server_id and uc.role_id = tab_user_play_info.role_id'; $sqlCost = M('user_play_data_count', 'tab_')->alias('uc') ->field('sum(uc.recharge_cost) cost') ->where($spendMap) @@ -1799,10 +1825,16 @@ class QueryController extends BaseController ->field('sum(uc.recharge_count) count') ->where($spendMap) ->buildSql(); - $query = M('user_play_info', 'tab_') - ->field("*,$sqlCost as cost,$sqlCount as count,$sqlTodayCost as today_cost") + $subQuery = M('user_play_info', 'tab_') + ->field("*,$sqlCost as recharge_cost,$sqlCount as recharge_count,$sqlTodayCost as recharge_cost_today") ->where($map) - ->order('play_time desc'); + ->order('play_time desc') + ->buildSql(); + $query = M()->field('*') + ->table($subQuery) + ->alias('a') + ->order($orderBy); + list($roles, $pagination, $count) = $this->paginate($query); foreach ($roles as $role) { @@ -1814,9 +1846,9 @@ class QueryController extends BaseController 'role_level' => $role['role_level'], 'server_id' => $role['server_id'], 'server_name' => $role['server_name'], - 'recharge_cost' => $role['cost'], - 'recharge_count' => $role['count'], - 'recharge_cost_today' => $role['cost_today'], + 'recharge_cost' => empty($role['recharge_cost']) ? 0 : $role['recharge_cost'], + 'recharge_count' => empty($role['recharge_count']) ? 0 : $role['recharge_count'], + 'recharge_cost_today' => empty($role['recharge_cost_today']) ? 0 : $role['recharge_cost_today'], 'play_time' => $role['play_time'], 'play_ip' => $role['play_ip'], 'promote_id' => $role['promote_id'], @@ -1835,6 +1867,7 @@ class QueryController extends BaseController $this->assign('count', $count); $this->assign('initBegTime', $initBegTime); $this->assign('initEndTime', $initEndTime); + $this->assign('sort', $sort); $this->display('userRecharges'); } @@ -1920,10 +1953,10 @@ class QueryController extends BaseController public function achievement() { $time = I('time', date('Y-m-d')); - if(!empty($time)) { - $defaultTime = $time ; - }else { - $defaultTime = date('Y-m-d',time()); + if (!empty($time)) { + $defaultTime = $time; + } else { + $defaultTime = date('Y-m-d', time()); } $sdkVersion = I('sdk_version', 0); $gameId = I('game_id', 0); @@ -2014,7 +2047,7 @@ class QueryController extends BaseController $rechargeCountList = $promoteRepository->getRechargeCountByIds($ids, $params); $rechargeUserCountList = $promoteRepository->getRechargeUserCountByIds($ids, $params); $rechargeAmountList = $promoteRepository->getRechargeAmountByIds($ids, $params); - + if (I('p', 1) == 1) { $selfParams = $params; $selfParams['isContainSubs'] = false; @@ -2083,7 +2116,7 @@ class QueryController extends BaseController $this->assign('parentid', $parentId); $this->assign('count', $count); $this->assign('timeout', $timeout); - $this->assign('time',$defaultTime); + $this->assign('time', $defaultTime); $this->display(); } @@ -2100,7 +2133,7 @@ class QueryController extends BaseController public function userPlayDataCount() { - $time = strtotime(date('Y-m-d 00:00:00',time() - (3600 * 24))); + $time = strtotime(date('Y-m-d 00:00:00', time() - (3600 * 24))); $spendMap['pay_status'] = 1; $spendMap['pay_game_status'] = 1; $spendMap['game_player_id'] = ['gt', 0]; diff --git a/Application/Home/View/default/Query/userRecharges.html b/Application/Home/View/default/Query/userRecharges.html index 96df2ea9e..db7089733 100644 --- a/Application/Home/View/default/Query/userRecharges.html +++ b/Application/Home/View/default/Query/userRecharges.html @@ -82,8 +82,9 @@
+ - +
@@ -102,7 +103,7 @@ 等级 充值总额 - + @@ -113,7 +114,7 @@ 充值次数 - + @@ -124,7 +125,7 @@ 今日充值 - + @@ -135,7 +136,7 @@ 未登录天数 - +