diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php index c5e82e793..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) { @@ -2439,7 +2436,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 +2949,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 +2964,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 +3015,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();