<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Vendor\QuickRun\Export; use ModStart\Core\Exception\BizException; use ModStart\Core\Input\InputPackage; use ModStart\Core\Input\Request; use ModStart\Core\Input\Response; class ExportHandle { private $data = array('pageTitle' => '导出数据', 'defaultExportName' => 'Export', 'headTitles' => array()); private $fetchCallback; public function withPageTitle($zaBao) { $this->data['pageTitle'] = $zaBao; return $this; } public function withDefaultExportName($hrkUK) { $this->data['defaultExportName'] = $hrkUK; return $this; } public function withHeadTitles($QSavc) { $this->data['headTitles'] = $QSavc; return $this; } public function handleFetch($caXDF) { $this->fetchCallback = $caXDF; return $this; } public function performExcel() { return $this->perform('xlsx', 'excel'); } public function performCsv() { return $this->perform('xlsx', 'csv'); } public function performCommon($f_HcG = array()) { return $this->perform(null, 'common', $f_HcG); } private function perform($HCF4y, $RiwEA, $f_HcG = array()) { goto xsbn3; Jliq3: if (Request::isPost()) { goto S2Orw; oQYJg: $xJzrK['list'] = $GVu1o['list']; goto g_3Qw; uH1LN: $xJzrK = array(); goto fIpvY; S2Orw: BizException::throwsIfEmpty('导出文件名为空', $CvH9D); goto Q9jyM; kahLE: return Response::generateSuccessData($xJzrK); goto c23mq; g_3Qw: $xJzrK['total'] = $GVu1o['total']; goto wvVrd; d0pfl: $xJzrK['exportName'] = $CvH9D . '.' . $xGv9g; goto DxoVJ; fIpvY: $xJzrK['code'] = 0; goto oQYJg; wvVrd: $xJzrK['finished'] = count($GVu1o['list']) != $Do_6A; goto d0pfl; Q9jyM: $GVu1o = call_user_func_array($this->fetchCallback, array($DNh5u, $Do_6A, $gS4KO, array())); goto uH1LN; DxoVJ: $xJzrK['exportHeadTitles'] = $this->data['headTitles']; goto kahLE; c23mq: } goto xBxdG; RJYSr: $hrkUK = $this->data['defaultExportName']; goto UmbxH; UmbxH: $OPo_x = InputPackage::buildFromInput(); goto CzFUS; xsbn3: if (null === $HCF4y) { $HCF4y = 'xlsx'; } goto wRRP4; CzFUS: $DNh5u = $OPo_x->getPage(); goto cvC7f; cvC7f: $Do_6A = $OPo_x->getPageSize(null, null, null, 100); goto O8Ha3; pRR9v: return view('module::Vendor.View.quickRun.export.' . $RiwEA, array('pageTitle' => $zaBao, 'exportName' => $CvH9D, 'total' => $GVu1o['total'], 'formats' => $f_HcG['formats'])); goto UHHjE; sFcqL: $CvH9D = $OPo_x->getTrimString('exportName', $hrkUK); goto y4Liy; wRRP4: if (!isset($f_HcG['formats'])) { $f_HcG['formats'] = array('xlsx', 'csv'); } goto Gur9o; O8Ha3: $gS4KO = $OPo_x->getJsonAsInput('_param')->getArray('search'); goto sFcqL; Gur9o: $zaBao = $this->data['pageTitle']; goto RJYSr; xBxdG: $GVu1o = call_user_func_array($this->fetchCallback, array(1, 1, $gS4KO, array())); goto pRR9v; y4Liy: $xGv9g = $OPo_x->getTrimString('format', $HCF4y); goto Jliq3; UHHjE: } }