<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Photo\Api\Controller; use ModStart\Core\Dao\ModelUtil; use ModStart\Core\Exception\BizException; use ModStart\Core\Input\InputPackage; use ModStart\Core\Input\Response; use Module\Photo\Type\PhotoCategoryVisitType; use Module\Photo\Util\PhotoAuthUtil; use Module\Photo\Util\PhotoCategoryUtil; use Module\Photo\Util\PhotoUtil; class PhotoController extends BaseController { public function latest() { goto KPNbX; jV72s: return Response::generateSuccessPaginateData(1, count($Ge6HJ), $Ge6HJ, count($Ge6HJ)); goto P_tzS; ACoAn: $fAvwi = InputPackage::buildFromInput(); goto NDhqG; KPNbX: $this->authCheck(); goto ACoAn; NDhqG: $BZCSp = $fAvwi->getInteger('limit', 5); goto eY2AT; eY2AT: $Ge6HJ = PhotoUtil::listLatest($BZCSp); goto jV72s; P_tzS: } public function paginate() { goto nElW2; yduAf: if ($IvrbI['visitType'] == PhotoCategoryVisitType::VISIT_PASSWORD) { if (!PhotoAuthUtil::isAuth($IvrbI['id'])) { return Response::generateError('未授权'); } } goto tlxfx; GfPGT: return Response::generateSuccessData(array('page' => $mQ9Jw, 'pageSize' => $UcEVj, 'total' => $gUmMN['total'], 'records' => $Ge6HJ, 'categoryId' => $gf2oi, 'currentCategory' => $IvrbI, 'keywords' => $U6XQq)); goto FIbhp; TLi5B: $mQ9Jw = $fAvwi->getPage(); goto nJjMl; AO1EQ: $fAvwi = InputPackage::buildFromInput(); goto TLi5B; iCs_m: if ($U6XQq) { $dKds6['whereOperate'][] = array('title', 'like', '%' . $U6XQq . '%'); } goto XVvb0; x1woX: BizException::throwsIfEmpty('分类不存在', $IvrbI); goto yduAf; XVvb0: $gUmMN = ModelUtil::paginate('photo', $mQ9Jw, $UcEVj, $dKds6); goto EJ4uG; tlxfx: $U6XQq = $fAvwi->getTrimString('keywords'); goto iCs_m; ylWzn: $dKds6['order'] = array('id', 'desc'); goto TqP3n; EJ4uG: $Ge6HJ = PhotoUtil::buildRecords($gUmMN['records']); goto GfPGT; nJjMl: $UcEVj = $fAvwi->getPageSize('pageSize', 16); goto NJNHg; nElW2: $this->authCheck(); goto AO1EQ; Zn_8_: $IvrbI = PhotoCategoryUtil::get($gf2oi); goto x1woX; NJNHg: $dKds6 = array(); goto SzxuC; TqP3n: $gf2oi = $fAvwi->getInteger('categoryId'); goto b8skY; b8skY: $dKds6['where']['categoryId'] = $gf2oi; goto Zn_8_; SzxuC: $dKds6['where'] = array(); goto ylWzn; FIbhp: } public function get() { goto pegWU; FBhrp: $HuYBt = PhotoUtil::get($DcXJr); goto ux2qy; axKXd: return Response::generateSuccessData($lnZQ_); goto FXo1E; pegWU: $this->authCheck(); goto YFXlT; ux2qy: $lnZQ_ = PhotoUtil::buildRecord($HuYBt); goto tEwC9; tEwC9: $lnZQ_['url'] = $HuYBt['url']; goto axKXd; YFXlT: $DcXJr = InputPackage::buildFromInput()->getInteger('id'); goto FBhrp; FXo1E: } }