From ac54bb41a4f9a6eb3b2803f0ca87ab2307641b83 Mon Sep 17 00:00:00 2001 From: sunke <18850253506@163.com> Date: Fri, 20 Mar 2020 18:04:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E4=BB=98=E9=99=90=E9=A2=9D=E5=AF=BC?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/ExportController.class.php | 127 ++++++++++++++++++ Application/Admin/View/Tool/limitPay.html | 1 + 2 files changed, 128 insertions(+) diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index cd0107f21..15339690a 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -2716,6 +2716,133 @@ class ExportController extends Controller fclose($fp); exit; break; + case 30: + $xlsCell = array( + "限制序号","限制支付渠道", "限制规则", "限制方式", "限制时间" + ); + + $params = I('get.'); + $payType = $params['pay_type']; + $limit_type = $params['limit_type']; + + $map = []; + if (!empty($payType)) { + $map['pay_type'] = $payType; + + } + + if (!empty($limit_type)) { + $map['limit_type'] = $limit_type; + + } + + $datas = M('pay_limit_conf', 'tab_') + ->field('id') + ->where($map) + ->order('id desc') + ->select(); + $csvFileName = '支付限额配置'.'.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流中 + $counts = count($datas); + $perSize = 10000;//每次查询的条数 + $pages = ceil($counts / $perSize); + + for($i = 1; $i <= $pages; $i++) { + $datas = M('pay_limit_conf', 'tab_') + ->where($map) + ->order('id desc') + ->limit(($i-1)*$perSize ,$perSize) + ->select(); + foreach ($datas as $key => $data) { + $csvdata['id'] = $data['id']; + if ($data['pay_type'] == 'alipay') { + $pay_type = '支付宝'; + } + if ($data['pay_type'] == 'wxpay') { + $pay_type = '微信'; + } + if ($data['pay_type'] == 'yeepay') { + $pay_type = '易宝'; + } + if ($data['pay_type'] == 'sqpay') { + $pay_type = '双乾'; + } + if ($data['limit_time_type'] == 'day') { + $limit_time_type = '每日,'; + } + if ($data['limit_time_type'] == 'week') { + $limit_time_type = '每周,'; + } + if ($data['limit_time_type'] == 'month') { + $limit_time_type = '每月,'; + } + if ($data['limit_time_type'] == 'fix') { + $limit_time_type = '特殊,'; + } + $csvdata['pay_type'] = $pay_type; + $limit_rule = ''; + if ( $data['user_total_limit']) { + $limit_rule .= '玩家全渠道总流水限额'.$data['user_total_limit']; + } + if ( $data['total_limit']) { + $limit_rule .= '全渠道总流水限额'.$data['total_limit']; + } + if ( $data['user_one_limit']) { + $limit_rule .= '玩家单笔限制'.$data['user_one_limit']; + } + if ($limit_rule == '') { + $limit_rule = '暂无规则'; + } + $csvdata['limit_rule'] = $limit_rule; + if ($data['limit_type'] == 'force') { + $csvdata['limit_type'] = '强制模式'; + } + if ($data['limit_type'] == 'obstacles') { + $csvdata['limit_type'] = '障碍模式'; + } + $start_timeArr = str_split($data['start_time'], 1); + $startTimeStr = ''; + foreach ($start_timeArr as $timeKey => $start_time) { + if ($timeKey == 1 || $timeKey == 3) { + $startTimeStr .= $start_time.':'; + }else { + $startTimeStr .= $start_time; + } + + } + + $end_timeArr = str_split($data['end_time'], 1); + $endTimeStr = ''; + foreach ($end_timeArr as $timeKey1 => $end_time) { + if ($timeKey1 == 1 || $timeKey1 == 3) { + $endTimeStr .= $end_time. ':'; + }else { + $endTimeStr .= $end_time; + } + + } + $csvdata['limit_time'] = $limit_time_type .$data['limit_time_type_remark'].' '.$startTimeStr.'~'.$endTimeStr; + mb_convert_variables('GBK', 'UTF-8', $csvdata); + fputcsv($fp, $csvdata); + } + unset($csvdata);//释放变量的内存 + //刷新输出缓冲到浏览器 + ob_flush(); + flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。 + } + fclose($fp); + exit; + + break; default: $xlsName = $xlsCell = $xlsData = []; diff --git a/Application/Admin/View/Tool/limitPay.html b/Application/Admin/View/Tool/limitPay.html index 7ee611f1e..204be4e78 100644 --- a/Application/Admin/View/Tool/limitPay.html +++ b/Application/Admin/View/Tool/limitPay.html @@ -78,6 +78,7 @@
+ 导出 {$_page}