<?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($LDUKQ) { $this->data['pageTitle'] = $LDUKQ; return $this; } public function withDefaultExportName($hROMd) { $this->data['defaultExportName'] = $hROMd; return $this; } public function withHeadTitles($Svpj_) { $this->data['headTitles'] = $Svpj_; return $this; } public function withCustomHeadTitle($Plsu_) { $this->data['customHeadTitle'] = $Plsu_; return $this; } public function handleFetch($hy4YA) { $this->fetchCallback = $hy4YA; return $this; } public function performExcel() { return $this->perform('xlsx', 'excel'); } public function performCsv() { return $this->perform('xlsx', 'csv'); } public function performCommon($EPwwc = array()) { return $this->perform(null, 'common', $EPwwc); } private function perform($zZGik, $RzPgc, $EPwwc = array()) { goto dokbA; JpWPq: $Nw6ws = InputPackage::buildFromInput(); goto m1ac6; ybGnU: $fFBu8 = call_user_func_array($this->fetchCallback, array(1, 1, $oHfcx, array())); goto wVscb; KxKCd: $IMHcB = $this->data['customHeadTitle']; goto JpWPq; e0IwQ: $hROMd = $this->data['defaultExportName']; goto xluCE; wVscb: return view('module::Vendor.View.quickRun.export.' . $RzPgc, array('pageTitle' => $LDUKQ, 'exportName' => $VpdK4, 'total' => $fFBu8['total'], 'formats' => $EPwwc['formats'], 'customHeadTitle' => $IMHcB, 'headTitles' => $Svpj_)); goto gaW0a; AMd94: $OB9LF = $Nw6ws->getPageSize(null, null, null, 100); goto gBu8I; bbdq0: if (!isset($EPwwc['formats'])) { $EPwwc['formats'] = array('xlsx', 'csv'); } goto LZaAM; hZGEa: $xZYtK = $Nw6ws->getTrimString('format', $zZGik); goto I2x0f; dokbA: if (null === $zZGik) { $zZGik = 'xlsx'; } goto bbdq0; xluCE: $Svpj_ = $this->data['headTitles']; goto KxKCd; QhlyX: if (Request::isPost()) { goto PerPG; fKj7i: $Pg57y['finished'] = count($fFBu8['list']) != $OB9LF; goto G4WG1; Y8Xw6: $fFBu8 = call_user_func_array($this->fetchCallback, array($j13Tr, $OB9LF, $oHfcx, array())); goto z6xwl; n26zB: $Pg57y['exportHeadTitles'] = $KT_BR; goto CXqsb; PCtU_: BizException::throwsIfEmpty('请选择导出列', $iuGG_); goto Y8Xw6; UexYW: $Pg57y['code'] = 0; goto WgbR3; WgbR3: $Pg57y['list'] = $YK6cM; goto PUPZF; PUPZF: $Pg57y['total'] = $fFBu8['total']; goto fKj7i; CXqsb: return Response::generateSuccessData($Pg57y); goto isr41; z6xwl: if ($IMHcB) { goto zPjKj; E4ejW: foreach ($fFBu8['list'] as $YxV2x) { goto PO_7B; PO_7B: $dRTD0 = array(); goto aoFVT; vS3zv: $YK6cM[] = $dRTD0; goto CITlD; aoFVT: foreach ($YxV2x as $FXKJT => $HZNGn) { if (in_array($FXKJT, $iuGG_)) { $dRTD0[] = $HZNGn; } } goto vS3zv; CITlD: } goto EyKec; zPjKj: $YK6cM = array(); goto E4ejW; MduY0: foreach ($this->data['headTitles'] as $PsIao => $YxV2x) { if (in_array($PsIao, $iuGG_)) { $KT_BR[] = $YxV2x; } } goto rDr0b; EyKec: $KT_BR = array(); goto MduY0; rDr0b: } else { $YK6cM = $fFBu8['list']; $KT_BR = $this->data['headTitles']; } goto myuNc; G4WG1: $Pg57y['exportName'] = $VpdK4 . '.' . $xZYtK; goto n26zB; myuNc: $Pg57y = array(); goto UexYW; PerPG: BizException::throwsIfEmpty('导出文件名为空', $VpdK4); goto PCtU_; isr41: } goto ybGnU; LZaAM: $LDUKQ = $this->data['pageTitle']; goto e0IwQ; gBu8I: $oHfcx = $Nw6ws->getJsonAsInput('_param')->getArray('search'); goto xeak0; xeak0: $VpdK4 = $Nw6ws->getTrimString('exportName', $hROMd); goto hZGEa; I2x0f: $iuGG_ = $Nw6ws->getJson('checkedHeadTitles'); goto QhlyX; m1ac6: $j13Tr = $Nw6ws->getPage(); goto AMd94; gaW0a: } }