From 962c2844677dabaf47b7e095ef879aa951c79a79 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Fri, 3 Jan 2020 18:37:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E7=BB=93=E7=AE=97--=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/QueryController.class.php | 14 ++++++++------ Application/Admin/View/Query/settlement.html | 4 +++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Application/Admin/Controller/QueryController.class.php b/Application/Admin/Controller/QueryController.class.php index 6a93470ce..ba364e38e 100644 --- a/Application/Admin/Controller/QueryController.class.php +++ b/Application/Admin/Controller/QueryController.class.php @@ -48,7 +48,7 @@ class QueryController extends ThinkController $endTime = I('timeend', get_lastweek_name(1)); $sortBy = I('sort_by', ''); $sortColumn = I('sort_column', ''); - $order = 'tab_spend.pay_time'; + $order = 'day'; $orderType = 'desc'; if (in_array($sortColumn, ['user_num', 'sum_amount'])) { @@ -66,7 +66,7 @@ class QueryController extends ThinkController $spendMap['tab_spend.selle_status'] = 0; $spendMap['tab_spend.pay_time'] = ['between', [$beginTime, $endTime]]; $spendMap['tab_spend.promote_id'] = ['in', $promoteIds]; - $spendField = 'tab_spend.promote_account, tab_spend.game_name, sum(tab_spend.pay_amount) as sum_amount, tab_spend.selle_ratio, sum(if(tab_spend.selle_ratio > 0, tab_spend.pay_amount * tab_spend.selle_ratio, 0)) as settlement_amount'; + $spendField = "tab_spend.game_id, tab_spend.game_name, sum(tab_spend.pay_amount) as sum_amount, tab_spend.selle_ratio, sum(if(tab_spend.selle_ratio > 0, tab_spend.pay_amount * tab_spend.selle_ratio, 0)) as settlement_amount, FROM_UNIXTIME(tab_spend.`pay_time`, '%Y-%m-%d') as day"; $userMap['tab_user.promote_id'] = ['in', $promoteIds]; $userMap['_string'] = 'tab_user.promote_id = tab_spend.promote_id'; $userField = M('user', 'tab_')->field('count(tab_user.id) as user_num') @@ -76,7 +76,7 @@ class QueryController extends ThinkController $query = M('spend', 'tab_')->field($field) ->where($spendMap) - ->group('tab_spend.selle_ratio, tab_spend.game_id, tab_spend.promote_id') + ->group('tab_spend.selle_ratio, tab_spend.game_id, day') ->order("{$order} {$orderType}"); if(I('export', 0) != 1){ $query->page($page, $row); @@ -85,9 +85,9 @@ class QueryController extends ThinkController ->alias('record') ->select(); if(I('export', 0) != 1){ - $countQuery = M('spend', 'tab_')->field('tab_spend.id') + $countQuery = M('spend', 'tab_')->field($spendField) ->where($spendMap) - ->group('tab_spend.selle_ratio, tab_spend.game_id, tab_spend.promote_id') + ->group('tab_spend.selle_ratio, tab_spend.game_id, day') ->buildSql(); $count = M()->table($countQuery) ->alias('tab_spend') @@ -111,6 +111,7 @@ class QueryController extends ThinkController $data = []; foreach ($records as $value) { $data[] = [ + 'day' => $value['day'], 'promote_account' => $value['promote_account'], 'game_name' => $value['game_name'], 'sum_amount' => $value['sum_amount'], @@ -122,7 +123,8 @@ class QueryController extends ThinkController } $field = [ - 'promote_account' => '推广员账号', + 'day' => '日期', + 'promote_account' => '会长账号', 'game_name' => '游戏名称', 'sum_amount' => '总充值', 'user_num' => '总注册', diff --git a/Application/Admin/View/Query/settlement.html b/Application/Admin/View/Query/settlement.html index 3d79cfd02..382e1a222 100644 --- a/Application/Admin/View/Query/settlement.html +++ b/Application/Admin/View/Query/settlement.html @@ -129,7 +129,8 @@ - 推广员账号 + 日期 + 会长账号 游戏名称 总充值 总注册 @@ -150,6 +151,7 @@ + {$record.day} {$record.promote_account} {$record.game_name} {$record['sum_amount']|default=0}