<?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($tGx1j) { $this->data['pageTitle'] = $tGx1j; return $this; } public function withDefaultExportName($HHxhx) { $this->data['defaultExportName'] = $HHxhx; return $this; } public function withHeadTitles($j4ukO) { $this->data['headTitles'] = $j4ukO; return $this; } public function withCustomHeadTitle($WSv7J) { $this->data['customHeadTitle'] = $WSv7J; return $this; } public function handleFetch($TIlpS) { $this->fetchCallback = $TIlpS; return $this; } public function performExcel() { return $this->perform('xlsx', 'excel'); } public function performCsv() { return $this->perform('xlsx', 'csv'); } public function performCommon($FRVtF = array()) { return $this->perform(null, 'common', $FRVtF); } private function perform($Zl0nq, $N8SrS, $FRVtF = array()) { goto a7Y41; W8w9g: $fPosT = $i3uTh->getTrimString('exportName', $HHxhx); goto Ckzty; uDWwH: $t3CmR = call_user_func_array($this->fetchCallback, array(1, 1, $tRqja, array())); goto IhFwt; UIVU3: $yfn4d = $i3uTh->getPage(); goto TkfI3; IhFwt: return view('module::Vendor.View.quickRun.export.' . $N8SrS, array('pageTitle' => $tGx1j, 'exportName' => $fPosT, 'total' => $t3CmR['total'], 'formats' => $FRVtF['formats'], 'customHeadTitle' => $PZ9aO, 'headTitles' => $j4ukO)); goto lX7VK; X4qbx: if (!isset($FRVtF['formats'])) { $FRVtF['formats'] = array('xlsx', 'csv'); } goto lLMsK; EOSW2: $PZ9aO = $this->data['customHeadTitle']; goto ExJtB; XcgML: $ujxy_ = $i3uTh->getJson('checkedHeadTitles'); goto NhEIo; lLMsK: $tGx1j = $this->data['pageTitle']; goto E4REI; a7Y41: if (null === $Zl0nq) { $Zl0nq = 'xlsx'; } goto X4qbx; E4REI: $HHxhx = $this->data['defaultExportName']; goto jyiXD; NhEIo: if (Request::isPost()) { goto lNZI6; GlXwn: $GpXwG['total'] = $t3CmR['total']; goto ATnX_; lNZI6: BizException::throwsIfEmpty('导出文件名为空', $fPosT); goto Po1W5; ATnX_: $GpXwG['finished'] = count($t3CmR['list']) != $EQ6wA; goto IqpOV; PzGTK: if ($PZ9aO) { goto P0K37; P0K37: $IiW4A = array(); goto obUIT; obUIT: foreach ($t3CmR['list'] as $SxG_W) { goto rXLGP; QpRpP: $IiW4A[] = $ZIYgy; goto EjXm1; ot2Tq: foreach ($SxG_W as $f4s_1 => $cwDx6) { if (in_array($f4s_1, $ujxy_)) { $ZIYgy[] = $cwDx6; } } goto QpRpP; rXLGP: $ZIYgy = array(); goto ot2Tq; EjXm1: } goto bJ7FS; Gmpq7: foreach ($this->data['headTitles'] as $Ayp9C => $SxG_W) { if (in_array($Ayp9C, $ujxy_)) { $sLjAS[] = $SxG_W; } } goto iFFVn; bJ7FS: $sLjAS = array(); goto Gmpq7; iFFVn: } else { $IiW4A = $t3CmR['list']; $sLjAS = $this->data['headTitles']; } goto BBfON; IqpOV: $GpXwG['exportName'] = $fPosT . '.' . $w1ngo; goto QM8hP; q1kG8: return Response::generateSuccessData($GpXwG); goto I0EZz; KmPxc: $t3CmR = call_user_func_array($this->fetchCallback, array($yfn4d, $EQ6wA, $tRqja, array())); goto PzGTK; QM8hP: $GpXwG['exportHeadTitles'] = $sLjAS; goto q1kG8; BBfON: $GpXwG = array(); goto FIyJC; XX2Oy: $GpXwG['list'] = $IiW4A; goto GlXwn; FIyJC: $GpXwG['code'] = 0; goto XX2Oy; Po1W5: BizException::throwsIfEmpty('请选择导出列', $ujxy_); goto KmPxc; I0EZz: } goto uDWwH; Ckzty: $w1ngo = $i3uTh->getTrimString('format', $Zl0nq); goto XcgML; TkfI3: $EQ6wA = $i3uTh->getPageSize(null, null, null, 100); goto maHOC; jyiXD: $j4ukO = $this->data['headTitles']; goto EOSW2; maHOC: $tRqja = $i3uTh->getJsonAsInput('_param')->getArray('search'); goto W8w9g; ExJtB: $i3uTh = InputPackage::buildFromInput(); goto UIVU3; lX7VK: } }