<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\News\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\Article\Util\ArticleUtil; use Module\News\Util\NewsUtil; class NewsController extends ModuleBaseController { private $api; public function __construct() { $this->api = app(\Module\News\Api\Controller\NewsController::class); } public function index() { goto r72dA; V3ln8: $g5RPQ = array(); goto oavK8; oavK8: $g5RPQ['news'] = $aNWPu['records']; goto ivCeo; UxaNf: $aNWPu = Response::tryGetData($this->api->paginate()); goto V3ln8; uS7xo: $g5RPQ['categories'] = NewsUtil::listCategories(); goto PngLD; ivCeo: $g5RPQ['categoryId'] = $Cj1F4->getInteger('categoryId'); goto uS7xo; PngLD: $g5RPQ['pageHtml'] = PageHtmlUtil::render($aNWPu['total'], $aNWPu['pageSize'], $aNWPu['page'], '?' . Request::mergeQueries(array('page' => array('{page}')))); goto P43JQ; P43JQ: if (ModuleManager::isModuleInstalled('Ad')) { $g5RPQ['ads'] = AdUtil::listByPositionWithCache('pcNewsListRight'); } goto XdD6B; XdD6B: return $this->view('news.list', $g5RPQ); goto rk3Oz; r72dA: $Cj1F4 = InputPackage::buildFromInput(); goto UxaNf; rk3Oz: } public function views($WXJys) { goto a129S; jyraM: $E1dZb = ModelUtil::model('news')->orderBy('id', 'desc')->limit(6)->get()->toArray(); goto DUj4p; KBz4Z: $g5RPQ['newsLatest'] = $E1dZb; goto eSJHJ; XKbdO: return $this->view('news.view', $g5RPQ); goto TmNuW; DUj4p: $g5RPQ = array(); goto gj2wz; eSJHJ: if (ModuleManager::isModuleInstalled('Ad')) { $g5RPQ['ads'] = AdUtil::listByPositionWithCache('pcNewsViewRight'); } goto XKbdO; a129S: $bs0Vd = NewsUtil::get($WXJys); goto dUOKV; bZpv5: $bs0Vd['_category'] = ModelUtil::get('news_category', array('id' => $bs0Vd['categoryId'])); goto jyraM; gj2wz: $g5RPQ['news'] = $bs0Vd; goto KBz4Z; dUOKV: if (empty($bs0Vd)) { return Response::send(-1, '新闻不存在'); } goto bZpv5; TmNuW: } }