<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Member\Api\Controller; use Illuminate\Routing\Controller; use ModStart\Core\Exception\BizException; use ModStart\Core\Input\InputPackage; use ModStart\Core\Input\Response; use Module\Member\Auth\MemberUser; use Module\Member\Support\MemberLoginCheck; use Module\Member\Util\MemberFavoriteUtil; class MemberFavoriteController extends Controller implements MemberLoginCheck { public function favorite() { goto GsefQ; XQFkL: $BEJrC = $Km8YS->getTrimString('category'); goto ZXteW; qxyKY: if ($Ix_Nr = $Km8YS->getTrimString('redirect')) { return Response::generate(0, null, null, $Ix_Nr); } goto p8PjM; X0hUk: BizException::throwsIfEmpty('category为空', $BEJrC); goto Cka9r; ZXteW: $I0Hpe = $Km8YS->getTrimString('categoryId'); goto X0hUk; GsefQ: $Km8YS = InputPackage::buildFromInput(); goto XQFkL; p8PjM: return Response::generateSuccess(); goto uQPju; hOhGh: if (MemberFavoriteUtil::exists(MemberUser::id(), $BEJrC, $I0Hpe)) { return Response::generateError('已经收藏'); } goto e5eAK; Cka9r: BizException::throwsIfEmpty('categoryId为空', $I0Hpe); goto hOhGh; e5eAK: MemberFavoriteUtil::add(MemberUser::id(), $BEJrC, $I0Hpe); goto qxyKY; uQPju: } public function unfavorite() { goto Mx2fI; M6OCd: BizException::throwsIfEmpty('categoryId为空', $I0Hpe); goto zXYww; unUnu: BizException::throwsIfEmpty('category为空', $BEJrC); goto M6OCd; fHNwx: $I0Hpe = $Km8YS->getTrimString('categoryId'); goto unUnu; hktCz: MemberFavoriteUtil::delete(MemberUser::id(), $BEJrC, $I0Hpe); goto JzRl_; JzRl_: if ($Ix_Nr = $Km8YS->getTrimString('redirect')) { return Response::generate(0, null, null, $Ix_Nr); } goto wfy5t; zXYww: if (!MemberFavoriteUtil::exists(MemberUser::id(), $BEJrC, $I0Hpe)) { return Response::generateError('未收藏'); } goto hktCz; Goqul: $BEJrC = $Km8YS->getTrimString('category'); goto fHNwx; Mx2fI: $Km8YS = InputPackage::buildFromInput(); goto Goqul; wfy5t: return Response::generateSuccess(); goto S5LKm; S5LKm: } }