<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\News\Api\Controller; use Illuminate\Routing\Controller; use ModStart\Core\Dao\ModelUtil; use ModStart\Core\Input\InputPackage; use ModStart\Core\Input\Response; use ModStart\Core\Util\ArrayUtil; use ModStart\Core\Util\HtmlUtil; use Module\News\Util\NewsUtil; class NewsController extends Controller { public function latest() { goto IR53H; yDWyf: $vKRZ2 = NewsUtil::listLatest($BMu21); goto ziNML; ziNML: return Response::generateSuccessPaginateData(1, count($vKRZ2), $vKRZ2, count($vKRZ2)); goto J1TBn; IR53H: $Cj1F4 = InputPackage::buildFromInput(); goto s5U03; s5U03: $BMu21 = $Cj1F4->getInteger('limit', 5); goto yDWyf; J1TBn: } public function paginate() { goto UTOpu; RZPEd: $aY5Ol['order'] = array('id', 'desc'); goto qNM93; qNM93: $q2QN6 = $Cj1F4->getInteger('categoryId'); goto Zs22c; KF_2x: $aY5Ol = array(); goto Ji1Cu; Aussv: return Response::generateSuccessData(array('page' => $qDx9U, 'pageSize' => $JDSm5, 'total' => $aNWPu['total'], 'records' => $vKRZ2)); goto LngYN; oNFZn: $JDSm5 = $Cj1F4->getPageSize(); goto KF_2x; B2yWZ: $qDx9U = $Cj1F4->getPage(); goto oNFZn; Ji1Cu: $aY5Ol['where'] = array(); goto RZPEd; UTOpu: $Cj1F4 = InputPackage::buildFromInput(); goto B2yWZ; Zs22c: if ($q2QN6) { $aY5Ol['where']['categoryId'] = $q2QN6; } goto sSXDZ; BXBj4: $vKRZ2 = NewsUtil::buildRecords($aNWPu['records']); goto Aussv; sSXDZ: $aNWPu = ModelUtil::paginate('news', $qDx9U, $JDSm5, $aY5Ol); goto BXBj4; LngYN: } public function get() { goto bpaFz; nZ5yV: $Lu5WV = NewsUtil::get($WXJys); goto cIWKb; RhRL5: return Response::generateSuccessData($bs0Vd); goto ybf2M; bpaFz: $WXJys = InputPackage::buildFromInput()->getInteger('id'); goto nZ5yV; bn2cm: $bs0Vd['content'] = $Lu5WV['content']; goto RhRL5; E52m_: $bs0Vd['cover'] = $Lu5WV['cover']; goto bn2cm; cIWKb: $bs0Vd = NewsUtil::buildRecord($Lu5WV); goto E52m_; ybf2M: } }