From ea140a430f2885d02c614dcd9fc28b5fe5d2d7f6 Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Wed, 8 Jan 2020 17:02:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=A8=A1=E6=9D=BF=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Common/extend.php | 83 +++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index 3fb91a02a..e2eb146d7 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -1336,9 +1336,11 @@ function templatelist(){ *返回游戏名称 */ function get_gamename($gid=0){ + if($gid == 0){return "未知";} $model = D("Game"); $list = $model->where("id=".$gid)->find(); +// return $list; return $list["game_name"]; } @@ -1826,4 +1828,85 @@ function getCompanyList() { } +function excelUpStreamTemplate() { + header("Content-type: text/html; charset=gb2312"); + error_reporting(E_ALL); + ini_set('display_errors', TRUE); + ini_set('display_startup_errors', TRUE); + + define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); + + date_default_timezone_set('Europe/London'); + Vendor("PHPExcel.PHPExcel"); + $objPHPExcel = new \PHPExcel(); + $objReader = \PHPExcel_IOFactory::createReader('Excel5'); + + //设置模板文件 + $objPHPExcel = $objReader->load("Runtime/upstream.xls"); + + + $objPHPExcel->getActiveSheet()->setCellValue('D2', 'chengzhi'); + + $objPHPExcel->getActiveSheet()->insertNewRowBefore(10,1)->mergeCells('J10:K10')->insertNewRowBefore(10,1)->mergeCells('J10:K10'); + + + ob_end_clean();//清除缓冲区,避免乱码 + header('pragma:public'); + header('Content-type:application/vnd.ms-excel;charset=utf-8;name="15415.xls"'); + header("Content-Disposition:attachment;filename=15415.xls");//attachment新窗口打印inline本窗口打印 + $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); + $objWriter->save('php://output'); + exit; + + } + +function excelDownStreamTemplate() { + header("Content-type: text/html; charset=gb2312"); + error_reporting(E_ALL); + ini_set('display_errors', TRUE); + ini_set('display_startup_errors', TRUE); + + define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); + + date_default_timezone_set('Europe/London'); + Vendor("PHPExcel.PHPExcel"); + $objPHPExcel = new \PHPExcel(); + $objReader = \PHPExcel_IOFactory::createReader('Excel5'); + + //设置模板文件 + $objPHPExcel = $objReader->load("upstream.xls"); + + + $objPHPExcel->getActiveSheet()->setCellValue('D2', 'chengzhi'); + + $objPHPExcel->getActiveSheet()->insertNewRowBefore(10,1); + + + ob_end_clean();//清除缓冲区,避免乱码 + header('pragma:public'); + header('Content-type:application/vnd.ms-excel;charset=utf-8;name="15415.xls"'); + header("Content-Disposition:attachment;filename=15415.xls");//attachment新窗口打印inline本窗口打印 + $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); + $objWriter->save('php://output'); + exit; + + } + +function getWithdrawNumber() { + + $map = []; + + $map['ext_field'] = ['neq',null]; + + $data = M('withdraw',"tab_") + ->field("widthdraw_number") + ->join("left join tab_statement as statement on tab_withdraw.widthdraw_number = statement.ext_field") + ->where("ext_field is null") + ->select(); + + return $data; + +} + + ?>