From 5df3a59df4cc3989fad82bd2b6f1c457747f7404 Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Fri, 13 Dec 2019 14:07:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B6=E6=8C=81=E5=8F=91=E6=94=BE=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/ExportController.class.php | 79 +++++++++++++++++++ Application/Admin/View/Support/lists.html | 1 + 2 files changed, 80 insertions(+) diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index eda60dbf7..2e6b1472d 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -6981,5 +6981,84 @@ if ($key == 'model'){ return $data; } + /** + * 推广补链 + * @author 鹿文学 + */ + public function Support_list() { + + $xlsName = $_REQUEST['xlsname']; + + $model = M('user','tab_'); + + $xlsCell = array( + '一级渠道','玩家账号','游戏名称','区服','角色名','申请额度','扶持类型','备注','申请时间','可用额度','实际发放额度','状态' + ); + + if(I('promote_id')){ + $map['promote_id']=I('promote_id'); + } + if(I('game_id')){ + $map['game_id']=I('game_id'); + } + if(!empty(I('apply_type')) || I('apply_type')==='0'){ + $map['apply_type']=I('apply_type'); + } + // + if(!empty(I('apply_status')) || I('apply_status')==='0'){ + $map['apply_status']=I('apply_status'); + } + + $csvFileName = $xlsName.'.csv'; + //设置好告诉浏览器要下载excel文件的headers + header('Content-Description: File Transfer'); + header('Content-Type: application/vnd.ms-excel'); + header('Content-Disposition: attachment; filename="'. $csvFileName .'"'); + header('Expires: 0'); + header('Cache-Control: must-revalidate'); + header('Pragma: public'); + $fp = fopen('php://output', 'a');//打开output流 + mb_convert_variables('GBK', 'UTF-8', $xlsCell); + fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中 + + $accessNum=M('test_resource','tab_')->where($map)->count(); + $perSize = 5000;//每次查询的条数 + $pages = ceil($accessNum / $perSize); + + for($i = 1; $i <= $pages; $i++) { + /* 获取频道列表 */ + $xlsData = M('test_resource','tab_') + ->field('promote_account,user_account,game_name,server_name,role_name, + apply_resource,apply_type,apply_remark,create_time,id as max_quota,verify_resource,apply_status') + ->where($map) + ->order('id desc') + ->select(); + + foreach($xlsData as $key => $value) { + + $value['create_time'] = date("Y-m-d H:i:s", $value['create_time']); + $value['max_quota'] = max_quota($value['game_id'],$value['promote_id']); + $value['apply_type'] = $value['apply_type']==0?'新增扶持':'后续扶持'; + if($value['apply_status'] == 1) { + $value['apply_status'] = '拒绝'; + } else if ($value['apply_status'] == 2) { + $value['apply_status'] = '通过'; + } else { + $value['apply_status'] = '待审核'; + } + + mb_convert_variables('GBK', 'UTF-8', $value); + fputcsv($fp, $value); + + } + unset($xlsData);//释放变量的内存 + //刷新输出缓冲到浏览器 + ob_flush(); + flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。 + } + fclose($fp); + exit(); + + } } diff --git a/Application/Admin/View/Support/lists.html b/Application/Admin/View/Support/lists.html index 344fc096d..8c82c84d7 100644 --- a/Application/Admin/View/Support/lists.html +++ b/Application/Admin/View/Support/lists.html @@ -170,6 +170,7 @@
+ 导出 {$_page|default=''}