From 381327ae217c490cbabf47f86b0d3a0901c60c3c Mon Sep 17 00:00:00 2001 From: chenzhi Date: Wed, 11 Mar 2020 14:33:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B8=B8=E6=88=8F=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/FinanceController.class.php | 8 ++++++-- Application/Admin/Model/SpendModel.class.php | 16 ++++++++++++++-- .../Admin/View/Finance/gameStatisticsDetail.html | 2 +- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Application/Admin/Controller/FinanceController.class.php b/Application/Admin/Controller/FinanceController.class.php index 4c97a2eac..d66eded35 100644 --- a/Application/Admin/Controller/FinanceController.class.php +++ b/Application/Admin/Controller/FinanceController.class.php @@ -698,6 +698,9 @@ class FinanceController extends ThinkController *游戏统计 */ public function gameStatistics($p = 1) { + if(!array_key_exists("timestart",$_REQUEST)){ + $this->redirect(ACTION_NAME, array('timestart' => date('Y-m-d',strtotime('-30 day')),"timeend"=>date('Y-m-d'))); + } $page = intval($p); $page = $page ? $page : 1; //默认显示第一页数据 $row = $_REQUEST['row'] ?? 10; @@ -738,8 +741,9 @@ class FinanceController extends ThinkController $data[$key]['all_cash_count'] = $value['cash_count'] + $value['balance_coin_count'] + $value['inside_cash_count']; } - $allData = D("spend")->gameStatistics($map);//列表总数 - $count = count($allData); + $count = D("spend")->gameStatisticsCount($map);//列表总数 + // $allData = D("spend")->gameStatistics($map);//列表总数 + // $count = count($allData); $page = set_pagination($count, $row); if ($page) { $this->assign('_page', $page);//分页 diff --git a/Application/Admin/Model/SpendModel.class.php b/Application/Admin/Model/SpendModel.class.php index bab8b51aa..67ccfa30a 100644 --- a/Application/Admin/Model/SpendModel.class.php +++ b/Application/Admin/Model/SpendModel.class.php @@ -840,7 +840,7 @@ class SpendModel extends Model */ public function gameStatistics($map, $row = 0, $page = 1) { - $query = $this->alias("s") + $query = M("Spend s use index(game_time)","tab_") ->field("s.game_id,s.game_name,p.partner as partner_name, g.game_type_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, @@ -856,13 +856,25 @@ SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as inside_cash_count,g.sd $data = $query->select(); return $data; } + public function gameStatisticsCount($map) + { + + $query = M("Spend s use index(game_time)","tab_") + ->field("game_id") + ->where(['s.pay_status' => 1, 'pay_game_status' => 1]) + ->where($map) + ->group('s.game_id'); + $data = $query->select(); + + return count($data); + } /** *获取游戏统计列表数据 */ public function totalGameStatistics($map, $join = true) { - $query = $this->alias("s") + $query = M("Spend s use index(game_time)","tab_") ->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"); diff --git a/Application/Admin/View/Finance/gameStatisticsDetail.html b/Application/Admin/View/Finance/gameStatisticsDetail.html index 486c4e509..67a583667 100644 --- a/Application/Admin/View/Finance/gameStatisticsDetail.html +++ b/Application/Admin/View/Finance/gameStatisticsDetail.html @@ -41,7 +41,7 @@
- 返回 + 返回