<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\CmsHelp\Web\Controller; use ModStart\Core\Dao\ModelUtil; use ModStart\Core\Exception\BizException; use ModStart\Core\Input\InputPackage; use ModStart\Core\Util\ArrayUtil; use ModStart\Core\Util\PageHtmlUtil; use ModStart\Module\ModuleBaseController; use Module\CmsHelp\Core\CmsHelpSuperSearchBiz; use Module\CmsHelp\Util\CmsHelpCategoryUtil; use Module\CmsHelp\Util\CmsHelpUtil; class CmsHelpController extends ModuleBaseController { private $api; public function __construct() { $this->api = app(\Module\CmsHelp\Api\Controller\CmsHelpController::class); } public function index() { $lG1Io = array(); return $this->view('cmsHelp.index', $lG1Io); } public function category($MkmbZ) { goto ICcSN; yQWGh: $lG1Io['category'] = $aCqo2; goto WZjPh; A9aG_: BizException::throwsIfEmpty('分类不存在', $aCqo2); goto xhp9j; i08Wb: return $this->view('cmsHelp.category', $lG1Io); goto cByEx; xhp9j: $lG1Io = array(); goto yQWGh; LLUqS: $lG1Io['cmsHelps'] = CmsHelpUtil::listByCategory($MkmbZ); goto i08Wb; ICcSN: $aCqo2 = CmsHelpCategoryUtil::get($MkmbZ); goto A9aG_; WZjPh: $lG1Io['categoryChain'] = CmsHelpCategoryUtil::chain($MkmbZ); goto LLUqS; cByEx: } public function show($MkmbZ) { goto fR3OH; fR3OH: $gvTPQ = CmsHelpUtil::get($MkmbZ); goto z3vwO; ytmRZ: $lG1Io = array(); goto aV5ZH; WwNuU: $lG1Io['categoryChain'] = CmsHelpCategoryUtil::chain($gvTPQ['categoryId']); goto md2py; aV5ZH: $lG1Io['record'] = $gvTPQ; goto WwNuU; z3vwO: BizException::throwsIfEmpty('记录不存在', $gvTPQ); goto Wagzs; md2py: return $this->view('cmsHelp.show', $lG1Io); goto eRwFp; Wagzs: $gvTPQ['_category'] = CmsHelpCategoryUtil::get($gvTPQ['categoryId']); goto ytmRZ; eRwFp: } public function search() { goto xfhPY; e45Vt: $yzKqK = CmsHelpSuperSearchBiz::provider(); goto ltoyt; gxpqG: $INQzX = 10; goto e45Vt; ltoyt: if ($yzKqK) { goto dqeY9; dqeY9: $WHE8z = array(); goto mRfxH; mRfxH: if ($RtF7Q) { $WHE8z['_or'] = array(array('title' => array('like' => $RtF7Q)), array('content' => array('like' => $RtF7Q))); } goto mf863; NO5nG: $oZBhJ = ArrayUtil::flatItemsByKey($xsi4V['records'], 'id'); goto fyW32; fyW32: $xsi4V['records'] = ModelUtil::allInWithOrder('cms_help', 'id', $oZBhJ); goto KsqpS; mf863: $xsi4V = $yzKqK->search('cms_help', $hpBip, $INQzX, $WHE8z); goto NO5nG; KsqpS: } else { goto PMNeR; Ha1jp: if ($RtF7Q) { $WHE8z = $WHE8z->where('title', 'like', '%' . $RtF7Q . '%'); } goto zd0rg; zd0rg: $Hu3jW = $WHE8z->paginate($INQzX, array('*'), 'page', $hpBip)->toArray(); goto CNsN9; CNsN9: $xsi4V = array('records' => $Hu3jW['data'], 'total' => $Hu3jW['total']); goto PeSsX; PMNeR: $WHE8z = ModelUtil::model('cms_help'); goto Ha1jp; PeSsX: } goto gm9Rg; ArCFT: $yNjK5['total'] = $xsi4V['total']; goto R05oV; UG7p6: $yNjK5['pageHtml'] = $W1uFG; goto b8nGj; gm9Rg: foreach ($xsi4V['records'] as $ZJIgz => $gvTPQ) { $xsi4V['records'][$ZJIgz]['_category'] = CmsHelpCategoryUtil::get($gvTPQ['categoryId']); } goto qDeXj; qDeXj: $W1uFG = PageHtmlUtil::render($xsi4V['total'], $INQzX, $hpBip, '/help/search?keyword=' . urlencode($RtF7Q) . '&page={page}'); goto hTbgo; uCaZo: $hpBip = $Q9nmo->getPage(); goto gxpqG; hzb7M: $yNjK5['records'] = $xsi4V['records']; goto ArCFT; cqwDL: $RtF7Q = $Q9nmo->getTrimString('keyword'); goto uCaZo; R05oV: return $this->view('cmsHelp.search', $yNjK5); goto HV1rX; hTbgo: $yNjK5 = array(); goto UG7p6; xfhPY: $Q9nmo = InputPackage::buildFromInput(); goto cqwDL; b8nGj: $yNjK5['keyword'] = $RtF7Q; goto hzb7M; HV1rX: } }