From f0d28e81c4d89823cdb7b9a380c17e0c9df47ea4 Mon Sep 17 00:00:00 2001 From: sunke <18850253506@163.com> Date: Tue, 26 Nov 2019 19:47:30 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/Controller/DownloadController.class.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php index c5e82e793..a7de2c5ca 100644 --- a/Application/Home/Controller/DownloadController.class.php +++ b/Application/Home/Controller/DownloadController.class.php @@ -2439,7 +2439,7 @@ class DownloadController extends BaseController { $perSize = 5000;//每次查询的条数 $pages = ceil($accessNum / $perSize); - for($i = 1; $i <= $pages - 1; $i++) { + for($i = 1; $i <= $pages; $i++) { foreach($data as $value) { mb_convert_variables('GBK', 'UTF-8', $value); fputcsv($fp, $value); @@ -2952,7 +2952,7 @@ class DownloadController extends BaseController { ->where($map) ->order('tab_spend.id desc') ->select(); - + $csvFileName = $xlsName.'.csv'; //设置好告诉浏览器要下载excel文件的headers header('Content-Description: File Transfer'); @@ -2967,6 +2967,7 @@ class DownloadController extends BaseController { $accessNum = count($data1)?:0 ; $perSize = 5000;//每次查询的条数 $pages = ceil($accessNum / $perSize); + for($i = 1; $i <= $pages; $i++) { $model = M('spend','tab_'); $data = $model @@ -3017,12 +3018,10 @@ class DownloadController extends BaseController { $csvData["p_proinfo"] = $value1["p_proinfo"]; $csvData["proinfo"] = $value1["proinfo"]; $csvData["pay_time"] = $value1["pay_time"]; + mb_convert_variables('GBK', 'UTF-8', $csvData); + fputcsv($fp, $csvData); $xlsData[] = $csvData; } - foreach($xlsData as $value) { - mb_convert_variables('GBK', 'UTF-8', $value); - fputcsv($fp, $value); - } unset($xlsData); ob_flush(); flush(); From ebfd596a4d82d6bed8aa9845809637c0b9b91d95 Mon Sep 17 00:00:00 2001 From: sunke <18850253506@163.com> Date: Tue, 26 Nov 2019 19:57:16 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Home/Controller/DownloadController.class.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php index a7de2c5ca..22d8a87ac 100644 --- a/Application/Home/Controller/DownloadController.class.php +++ b/Application/Home/Controller/DownloadController.class.php @@ -1163,9 +1163,6 @@ class DownloadController extends BaseController { * @author sunke */ public function recharge_data_export() { - if (empty(I('begtime')) || empty(I('endtime'))) { - $this->error('请选择起止时间'); - } $beginTime = strtotime(I('begtime') . ' 00:00:00'); $endtime = strtotime(I('endtime') . ' 23:59:59'); if (($endtime - $beginTime) > 31 * 24 * 3600) { From d8a59b567051b1b068cdf309d041f30a7256a2c0 Mon Sep 17 00:00:00 2001 From: yulingwei <2436953959@qq.com> Date: Tue, 26 Nov 2019 20:15:39 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/MemberController.class.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Application/Admin/Controller/MemberController.class.php b/Application/Admin/Controller/MemberController.class.php index a20bc258a..c89d06dc9 100644 --- a/Application/Admin/Controller/MemberController.class.php +++ b/Application/Admin/Controller/MemberController.class.php @@ -223,9 +223,11 @@ class MemberController extends ThinkController ->group('tab_user.id') ->where($hav) ->having($havs)->select(false); + + $allcountsql = str_replace("tab_user.promote_id","ss.promote_id",$sql); //获取总额 - $allcount = M()->field('count(a.id) as count,sum(a.recharge_total) recharge_total')->table('(' . $sql . ') as a')->select(); - $this->assign('history_count', $allcount[0]['recharge_total']); + $allcount = M()->field('count(a.id) as count,sum(a.recharge_total) recharge_total')->table('(' . $allcountsql . ') as a')->select(); + $this->assign('history_count', $allcount[0]['recharge_total']?:0); //替换为新表 if($_REQUEST['promote_id'] && $_REQUEST['promote_id'] > -1){ @@ -240,10 +242,10 @@ class MemberController extends ThinkController } $jcount = M('User', 'tab_')->field('count(a.id) as count,sum(a.recharge_total) recharge_total')->table('(' . $sql . ') as a')->select(); - $count = $jcount[0]['count']; - //var_dump(M('User', 'tab_')->getLastSql());die(); + $count = $jcount[0]['count'] ?:0 ; $this->assign('user_count', $count); - $this->assign('now_count', $jcount[0]['recharge_total']); + // var_dump($jcount);die(); + $this->assign('now_count', $jcount[0]['recharge_total']?:0); $model = M('Model')->getByName('user');