<?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($dhknk) { $this->data['pageTitle'] = $dhknk; return $this; } public function withDefaultExportName($pck2M) { $this->data['defaultExportName'] = $pck2M; return $this; } public function withHeadTitles($vQNyr) { $this->data['headTitles'] = $vQNyr; return $this; } public function withCustomHeadTitle($K10pP) { $this->data['customHeadTitle'] = $K10pP; return $this; } public function handleFetch($GdSl0) { $this->fetchCallback = $GdSl0; return $this; } public function performExcel() { return $this->perform('xlsx', 'excel'); } public function performCsv() { return $this->perform('xlsx', 'csv'); } public function performCommon($qOrzw = array()) { return $this->perform(null, 'common', $qOrzw); } private function perform($ofwGA, $qVdRh, $qOrzw = array()) { goto rmKWU; MIMZ9: return view('module::Vendor.View.quickRun.export.' . $qVdRh, array('pageTitle' => $dhknk, 'exportName' => $YvEPN, 'total' => $y6j27['total'], 'formats' => $qOrzw['formats'], 'customHeadTitle' => $ZSvLy, 'headTitles' => $vQNyr)); goto Im82u; hYXFf: $pck2M = $this->data['defaultExportName']; goto isZ4B; G3l05: if (Request::isPost()) { goto L5Yt0; d1Rk1: $U8wjN = array(); goto Q67ui; jHLk8: $U8wjN['total'] = $y6j27['total']; goto HEcV7; Zop5z: return Response::generateSuccessData($U8wjN); goto cJZoY; uevNG: $U8wjN['list'] = $K938W; goto jHLk8; HEcV7: $U8wjN['finished'] = count($y6j27['list']) != $WrYIu; goto mDWgO; Q67ui: $U8wjN['code'] = 0; goto uevNG; lVpCw: $y6j27 = call_user_func_array($this->fetchCallback, array($JcqUq, $WrYIu, $oYeH5, array())); goto vWdRx; vWdRx: if ($ZSvLy) { goto fIcU2; h5AA2: $FekBR = array(); goto GpOIw; fIcU2: $K938W = array(); goto kI7jg; kI7jg: foreach ($y6j27['list'] as $y2Ltn) { goto LIAjC; mVkI6: foreach ($y2Ltn as $nMjgN => $sy2BE) { if (in_array($nMjgN, $TpoX1)) { $M0WVk[] = $sy2BE; } } goto ti7ve; LIAjC: $M0WVk = array(); goto mVkI6; ti7ve: $K938W[] = $M0WVk; goto gtBXV; gtBXV: } goto h5AA2; GpOIw: foreach ($this->data['headTitles'] as $NAFuY => $y2Ltn) { if (in_array($NAFuY, $TpoX1)) { $FekBR[] = $y2Ltn; } } goto IhXn0; IhXn0: } else { $K938W = $y6j27['list']; $FekBR = $this->data['headTitles']; } goto d1Rk1; wi2DT: BizException::throwsIfEmpty('请选择导出列', $TpoX1); goto lVpCw; mDWgO: $U8wjN['exportName'] = $YvEPN . '.' . $SLriO; goto wcF3D; wcF3D: $U8wjN['exportHeadTitles'] = $FekBR; goto Zop5z; L5Yt0: BizException::throwsIfEmpty('导出文件名为空', $YvEPN); goto wi2DT; cJZoY: } goto voexF; lNn2u: $TpoX1 = $WZ8dY->getJson('checkedHeadTitles'); goto G3l05; zrGYw: $YvEPN = $WZ8dY->getTrimString('exportName', $pck2M); goto pyfQR; rmKWU: if (null === $ofwGA) { $ofwGA = 'xlsx'; } goto m9sEo; ejcm8: $ZSvLy = $this->data['customHeadTitle']; goto sjXC8; voexF: $y6j27 = call_user_func_array($this->fetchCallback, array(1, 1, $oYeH5, array())); goto MIMZ9; sjXC8: $WZ8dY = InputPackage::buildFromInput(); goto kqPuS; FX_74: $WrYIu = $WZ8dY->getPageSize(null, null, null, 100); goto hG0si; isZ4B: $vQNyr = $this->data['headTitles']; goto ejcm8; pyfQR: $SLriO = $WZ8dY->getTrimString('format', $ofwGA); goto lNn2u; hG0si: $oYeH5 = $WZ8dY->getJsonAsInput('_param')->getArray('search'); goto zrGYw; chP6c: $dhknk = $this->data['pageTitle']; goto hYXFf; m9sEo: if (!isset($qOrzw['formats'])) { $qOrzw['formats'] = array('xlsx', 'csv'); } goto chP6c; kqPuS: $JcqUq = $WZ8dY->getPage(); goto FX_74; Im82u: } }