<?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($lqr_d) { $this->data['pageTitle'] = $lqr_d; return $this; } public function withDefaultExportName($fGhqv) { $this->data['defaultExportName'] = $fGhqv; return $this; } public function withHeadTitles($Eq0Re) { $this->data['headTitles'] = $Eq0Re; return $this; } public function withCustomHeadTitle($Mpi3o) { $this->data['customHeadTitle'] = $Mpi3o; return $this; } public function handleFetch($eIeJB) { $this->fetchCallback = $eIeJB; return $this; } public function performExcel() { return $this->perform('xlsx', 'excel'); } public function performCsv() { return $this->perform('xlsx', 'csv'); } public function performCommon($w6bW5 = array()) { return $this->perform(null, 'common', $w6bW5); } private function perform($cd69r, $kF488, $w6bW5 = array()) { goto k8Tpb; vgaun: $Km8YS = InputPackage::buildFromInput(); goto LdNwK; vwR3J: $xx0L1 = $Km8YS->getTrimString('exportName', $fGhqv); goto Mc1dD; DKAXP: $N8UD0 = $Km8YS->getJsonAsInput('_param')->getArray('search'); goto vwR3J; uHyNK: if (!isset($w6bW5['formats'])) { $w6bW5['formats'] = array('xlsx', 'csv'); } goto b6bCT; LdNwK: $iXUoW = $Km8YS->getPage(); goto LIoKP; dkgke: return view('module::Vendor.View.quickRun.export.' . $kF488, array('pageTitle' => $lqr_d, 'exportName' => $xx0L1, 'total' => $fPAoT['total'], 'formats' => $w6bW5['formats'], 'customHeadTitle' => $YLJNg, 'headTitles' => $Eq0Re)); goto w0jI8; b6bCT: $lqr_d = $this->data['pageTitle']; goto CfICp; K3AnJ: $Eq0Re = $this->data['headTitles']; goto e6ZSM; J0_a6: $fPAoT = call_user_func_array($this->fetchCallback, array(1, 1, $N8UD0, array())); goto dkgke; XAXNz: $tUVfb = $Km8YS->getJson('checkedHeadTitles'); goto xGvtW; CfICp: $fGhqv = $this->data['defaultExportName']; goto K3AnJ; e6ZSM: $YLJNg = $this->data['customHeadTitle']; goto vgaun; LIoKP: $VUK_X = $Km8YS->getPageSize(null, null, null, 100); goto DKAXP; Mc1dD: $KJlVt = $Km8YS->getTrimString('format', $cd69r); goto XAXNz; xGvtW: if (Request::isPost()) { goto XHffk; W4OBI: BizException::throwsIfEmpty('请选择导出列', $tUVfb); goto bCZFZ; AoA6l: if ($YLJNg) { goto vAQUX; vAQUX: $sT6YU = array(); goto PJJYl; PJJYl: foreach ($fPAoT['list'] as $Iim2u) { goto KABRD; lIBKT: $sT6YU[] = $vetOJ; goto cfzYU; qCxn3: foreach ($Iim2u as $mTgPG => $Z0VQT) { if (in_array($mTgPG, $tUVfb)) { $vetOJ[] = $Z0VQT; } } goto lIBKT; KABRD: $vetOJ = array(); goto qCxn3; cfzYU: } goto gfSab; gfSab: $GUAeh = array(); goto zUlkZ; zUlkZ: foreach ($this->data['headTitles'] as $i0YzC => $Iim2u) { if (in_array($i0YzC, $tUVfb)) { $GUAeh[] = $Iim2u; } } goto adkBz; adkBz: } else { $sT6YU = $fPAoT['list']; $GUAeh = $this->data['headTitles']; } goto WsNjT; LrvEb: $avcnU['exportHeadTitles'] = $GUAeh; goto o5AL6; CLmun: $avcnU['total'] = $fPAoT['total']; goto LNNQG; WsNjT: $avcnU = array(); goto oxzy0; LNNQG: $avcnU['finished'] = count($fPAoT['list']) != $VUK_X; goto EQdMK; XHffk: BizException::throwsIfEmpty('导出文件名为空', $xx0L1); goto W4OBI; oxzy0: $avcnU['code'] = 0; goto vD3XK; o5AL6: return Response::generateSuccessData($avcnU); goto Ynjj4; bCZFZ: $fPAoT = call_user_func_array($this->fetchCallback, array($iXUoW, $VUK_X, $N8UD0, array())); goto AoA6l; EQdMK: $avcnU['exportName'] = $xx0L1 . '.' . $KJlVt; goto LrvEb; vD3XK: $avcnU['list'] = $sT6YU; goto CLmun; Ynjj4: } goto J0_a6; k8Tpb: if (null === $cd69r) { $cd69r = 'xlsx'; } goto uHyNK; w0jI8: } }