<?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(), 'customHeadTitle' => false); private $fetchCallback; public function withPageTitle($aXgwy) { $this->data['pageTitle'] = $aXgwy; return $this; } public function withDefaultExportName($HAT3q) { $this->data['defaultExportName'] = $HAT3q; return $this; } public function withHeadTitles($zhJAo) { $this->data['headTitles'] = $zhJAo; return $this; } public function withCustomHeadTitle($XdAd6) { $this->data['customHeadTitle'] = $XdAd6; return $this; } public function handleFetch($NOPYJ) { $this->fetchCallback = $NOPYJ; return $this; } public function performExcel() { return $this->perform('xlsx', 'excel'); } public function performCsv() { return $this->perform('xlsx', 'csv'); } public function performCommon($quZRe = array()) { return $this->perform(null, 'common', $quZRe); } private function perform($r3sj4, $z619t, $quZRe = array()) { goto CinTg; oDZPQ: $aXgwy = $this->data['pageTitle']; goto mMLYN; LAWcq: return view('module::Vendor.View.quickRun.export.' . $z619t, array('pageTitle' => $aXgwy, 'exportName' => $SccrI, 'total' => $xsi4V['total'], 'formats' => $quZRe['formats'], 'customHeadTitle' => $LjZ0C, 'headTitles' => $zhJAo)); goto HFcBA; WMCMK: $INQzX = $Q9nmo->getPageSize(null, null, null, 100); goto Sx1Fq; Dc5Xn: $xsi4V = call_user_func_array($this->fetchCallback, array(1, 1, $NXx5z, array())); goto LAWcq; TcPvf: if (!isset($quZRe['formats'])) { $quZRe['formats'] = array('xlsx', 'csv'); } goto oDZPQ; Enpuy: $SLM0V = $Q9nmo->getTrimString('format', $r3sj4); goto Px5Rn; P1Lx8: $zhJAo = $this->data['headTitles']; goto lmu2e; Px5Rn: $cScpJ = $Q9nmo->getJson('checkedHeadTitles'); goto B0n0T; B0n0T: if (Request::isPost()) { goto ZDorH; KUXBK: return Response::generateSuccessData($MGhSY); goto Pmnxr; PJN5N: $MGhSY['exportName'] = $SccrI . '.' . $SLM0V; goto YzR1s; RJea5: $xsi4V = call_user_func_array($this->fetchCallback, array($hpBip, $INQzX, $NXx5z, array())); goto VOPVQ; YzR1s: $MGhSY['exportHeadTitles'] = $psf0N; goto KUXBK; ZDorH: BizException::throwsIfEmpty('导出文件名为空', $SccrI); goto JzSTs; JzSTs: BizException::throwsIfEmpty('请选择导出列', $cScpJ); goto RJea5; stWQq: $MGhSY['total'] = $xsi4V['total']; goto cXlLN; VOPVQ: if ($LjZ0C) { goto dWqbW; dWqbW: $ymJ2H = array(); goto jAw3s; jAw3s: foreach ($xsi4V['list'] as $nfRLq) { goto QREb_; jTMvv: $ymJ2H[] = $J03ZP; goto FcvZI; FpxCc: foreach ($nfRLq as $nRjbS => $VCowf) { if (in_array($nRjbS, $cScpJ)) { $J03ZP[] = $VCowf; } } goto jTMvv; QREb_: $J03ZP = array(); goto FpxCc; FcvZI: } goto sesut; sesut: $psf0N = array(); goto B0KX_; B0KX_: foreach ($this->data['headTitles'] as $ZJIgz => $nfRLq) { if (in_array($ZJIgz, $cScpJ)) { $psf0N[] = $nfRLq; } } goto eR0s1; eR0s1: } else { $ymJ2H = $xsi4V['list']; $psf0N = $this->data['headTitles']; } goto JR_GX; cXlLN: $MGhSY['finished'] = count($xsi4V['list']) != $INQzX; goto PJN5N; b40oV: $MGhSY['code'] = 0; goto MfeuM; MfeuM: $MGhSY['list'] = $ymJ2H; goto stWQq; JR_GX: $MGhSY = array(); goto b40oV; Pmnxr: } goto Dc5Xn; mMLYN: $HAT3q = $this->data['defaultExportName']; goto P1Lx8; N45Q1: $hpBip = $Q9nmo->getPage(); goto WMCMK; lmu2e: $LjZ0C = $this->data['customHeadTitle']; goto gT9vv; dKqxr: $SccrI = $Q9nmo->getTrimString('exportName', $HAT3q); goto Enpuy; gT9vv: $Q9nmo = InputPackage::buildFromInput(); goto N45Q1; Sx1Fq: $NXx5z = $Q9nmo->getJsonAsInput('_param')->getArray('search'); goto dKqxr; CinTg: if (null === $r3sj4) { $r3sj4 = 'xlsx'; } goto TcPvf; HFcBA: } }