From ee6c6e62b269220b4d8b05758ebd09aeb139da85 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Thu, 26 Dec 2019 17:51:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=85=E5=80=BC=E7=8E=A9=E5=AE=B6--=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Home/Controller/DownloadController.class.php | 8 ++++++-- Application/Home/Controller/QueryController.class.php | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php index 3d5ecca69..5f672dec9 100644 --- a/Application/Home/Controller/DownloadController.class.php +++ b/Application/Home/Controller/DownloadController.class.php @@ -3238,9 +3238,13 @@ class DownloadController extends BaseController { $roles = M()->alias('record') ->table($subQuery) ->select(); - $total = M('spend','tab_')->alias('uc') - ->field("$fieldS,$fieldToday as recharge_cost_today") + $totalSql = M('spend', 'tab_')->alias('uc') + ->field("$fieldS, $fieldToday as recharge_cost_today") ->where($map) + ->buildSql(); + $total = M()->table($totalSql) + ->alias('total') + ->field('sum(recharge_cost) as recharge_cost, sum(recharge_count) as recharge_count, sum(recharge_cost_today) as recharge_cost_today') ->find(); $total['recharge_cost_today'] = empty($total['recharge_cost_today']) ? '0.00' :$total['recharge_cost_today']; $csvFileName = $xlsName.'.csv'; diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 73395f72c..9a5c3059b 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -1872,9 +1872,13 @@ class QueryController extends BaseController list($records, $pagination, $count) = $this->paginate($query); - $total = M('spend', 'tab_')->alias('s') + $totalSql = M('spend', 'tab_')->alias('s') ->field("$fieldS, $fieldToday as recharge_cost_today") ->where($map) + ->buildSql(); + $total = M()->table($totalSql) + ->alias('total') + ->field('sum(recharge_cost) as recharge_cost, sum(recharge_count) as recharge_count, sum(recharge_cost_today) as recharge_cost_today') ->find(); $total['recharge_cost_today'] = empty($total['recharge_cost_today']) ? '0.00' : $total['recharge_cost_today'];