<?php
 namespace Module\CmsJob\Web\Controller; use ModStart\Core\Dao\ModelUtil; use ModStart\Core\Input\InputPackage; use ModStart\Core\Input\Request; use ModStart\Core\Input\Response; use ModStart\Core\Util\PageHtmlUtil; use ModStart\Module\ModuleBaseController; use ModStart\Module\ModuleManager; use Module\Ad\Util\AdUtil; use Module\CmsJob\Util\CmsJobUtil; class CmsJobController extends ModuleBaseController { private $api; public function __construct() { $this->api = app(\Module\CmsJob\Api\Controller\CmsJobController::class); } public function index() { $paginateData = Response::tryGetData($this->api->paginate()); $dataView = []; $dataView['records'] = $paginateData['records']; $dataView['pageHtml'] = PageHtmlUtil::render($paginateData['total'], $paginateData['pageSize'], $paginateData['page'], '?' . Request::mergeQueries(['page' => ['{page}']])); if (ModuleManager::isModuleInstalled('Ad')) { $dataView['ads'] = AdUtil::listByPositionWithCache('pcCmsJobListRight'); } return $this->view('cmsJob.list', $dataView); } public function views($id) { $record = CmsJobUtil::get($id); if (empty($record)) { return Response::send(-1, '新闻不存在'); } $dataView = []; $dataView['record'] = $record; if (ModuleManager::isModuleInstalled('Ad')) { $dataView['ads'] = AdUtil::listByPositionWithCache('pcCmsJobViewRight'); } return $this->view('cmsJob.view', $dataView); } }