<?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($GZP1b) { $this->data['pageTitle'] = $GZP1b; return $this; } public function withDefaultExportName($A27Ev) { $this->data['defaultExportName'] = $A27Ev; return $this; } public function withHeadTitles($FT1IG) { $this->data['headTitles'] = $FT1IG; return $this; } public function withCustomHeadTitle($qH0w_) { $this->data['customHeadTitle'] = $qH0w_; return $this; } public function handleFetch($Ikxtb) { $this->fetchCallback = $Ikxtb; return $this; } public function performExcel() { return $this->perform('xlsx', 'excel'); } public function performCsv() { return $this->perform('xlsx', 'csv'); } public function performCommon($mzzZ3 = array()) { return $this->perform(null, 'common', $mzzZ3); } private function perform($zBvIU, $vYMai, $mzzZ3 = array()) { goto VXooi; QE_UA: $UcEVj = $fAvwi->getPageSize(null, null, null, 100); goto ptR_W; tNqbL: $gUmMN = call_user_func_array($this->fetchCallback, array(1, 1, $JKYSi, array())); goto x28l5; x28l5: return view('module::Vendor.View.quickRun.export.' . $vYMai, array('pageTitle' => $GZP1b, 'exportName' => $Hs1hc, 'total' => $gUmMN['total'], 'formats' => $mzzZ3['formats'], 'customHeadTitle' => $t5mJS, 'headTitles' => $FT1IG)); goto B1c_5; X8QHU: $FT1IG = $this->data['headTitles']; goto wYbYO; oGKTu: $fAvwi = InputPackage::buildFromInput(); goto QDlfS; Eba4F: $A27Ev = $this->data['defaultExportName']; goto X8QHU; cccfD: $GZP1b = $this->data['pageTitle']; goto Eba4F; bIf7K: $m55qe = $fAvwi->getTrimString('format', $zBvIU); goto Xpl37; wYbYO: $t5mJS = $this->data['customHeadTitle']; goto oGKTu; QDlfS: $mQ9Jw = $fAvwi->getPage(); goto QE_UA; Xpl37: $S06Qr = $fAvwi->getJson('checkedHeadTitles'); goto JwEuH; JwEuH: if (Request::isPost()) { goto TK1aC; sC3NW: $q62oK['exportName'] = $Hs1hc . '.' . $m55qe; goto lUfrZ; mfXhU: $q62oK = array(); goto YIXpt; oQL_B: BizException::throwsIfEmpty('请选择导出列', $S06Qr); goto w2xp3; w2xp3: $gUmMN = call_user_func_array($this->fetchCallback, array($mQ9Jw, $UcEVj, $JKYSi, array())); goto Bs6Jn; lUfrZ: $q62oK['exportHeadTitles'] = $SpP2E; goto fSqwt; Bs6Jn: if ($t5mJS) { goto MrcCh; m0qIn: foreach ($this->data['headTitles'] as $QhDyd => $hf0nR) { if (in_array($QhDyd, $S06Qr)) { $SpP2E[] = $hf0nR; } } goto LAq4p; lgkZw: foreach ($gUmMN['list'] as $hf0nR) { goto ZQuTA; ZE60C: $VWZyz[] = $m3pn4; goto AJp26; ZQuTA: $m3pn4 = array(); goto GP5xK; GP5xK: foreach ($hf0nR as $ucCde => $QbAzI) { if (in_array($ucCde, $S06Qr)) { $m3pn4[] = $QbAzI; } } goto ZE60C; AJp26: } goto jriYY; jriYY: $SpP2E = array(); goto m0qIn; MrcCh: $VWZyz = array(); goto lgkZw; LAq4p: } else { $VWZyz = $gUmMN['list']; $SpP2E = $this->data['headTitles']; } goto mfXhU; wLrWu: $q62oK['finished'] = count($gUmMN['list']) != $UcEVj; goto sC3NW; TK1aC: BizException::throwsIfEmpty('导出文件名为空', $Hs1hc); goto oQL_B; YIXpt: $q62oK['code'] = 0; goto GyFrR; GyFrR: $q62oK['list'] = $VWZyz; goto yB1Ik; yB1Ik: $q62oK['total'] = $gUmMN['total']; goto wLrWu; fSqwt: return Response::generateSuccessData($q62oK); goto NKBjH; NKBjH: } goto tNqbL; oOTsr: $Hs1hc = $fAvwi->getTrimString('exportName', $A27Ev); goto bIf7K; VXooi: if (null === $zBvIU) { $zBvIU = 'xlsx'; } goto ublVl; ptR_W: $JKYSi = $fAvwi->getJsonAsInput('_param')->getArray('search'); goto oOTsr; ublVl: if (!isset($mzzZ3['formats'])) { $mzzZ3['formats'] = array('xlsx', 'csv'); } goto cccfD; B1c_5: } }