<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Member\Api\Controller; use ModStart\Core\Exception\BizException; use ModStart\Core\Input\InputPackage; use ModStart\Core\Input\Response; use ModStart\Core\Util\CRUDUtil; use ModStart\Module\ModuleBaseController; use Module\Member\Auth\MemberUser; use Module\Member\Support\MemberLoginCheck; use Module\Member\Util\MemberAddressUtil; class MemberAddressController extends ModuleBaseController implements MemberLoginCheck { public function all() { return Response::generateSuccessData(MemberAddressUtil::listUserAddresses(MemberUser::id())); } public function getDefault() { return Response::generateSuccessData(MemberAddressUtil::getDefault(MemberUser::id())); } public function edit() { goto GmPvi; BUsaW: if ($Pg57y['isDefault']) { MemberAddressUtil::resetDefault(MemberUser::id()); } goto KmBqt; TSES2: $M3rBS = $Nw6ws->getInteger('id'); goto Ljuwd; o95AP: BizException::throwsIfEmpty('详细地址为空', $Pg57y['detail']); goto BUsaW; MorAC: if ($M3rBS) { $UiYds = MemberAddressUtil::getUserAddress(MemberUser::id(), $M3rBS); BizException::throwsIfEmpty('地址不存在', $UiYds); } goto d_ay4; KmBqt: if ($UiYds) { MemberAddressUtil::update($UiYds['id'], $Pg57y); } else { $Pg57y['memberUserId'] = MemberUser::id(); MemberAddressUtil::insert($Pg57y); } goto KO_Vj; sFeC1: BizException::throwsIfEmpty('姓名为空', $Pg57y['name']); goto kJACr; ANZvo: $Pg57y['detail'] = $Nw6ws->getTrimString('detail'); goto N5CY6; Ie7r5: $Pg57y['phone'] = $Nw6ws->getTrimString('phone'); goto KnNvO; d_ay4: $Pg57y = array(); goto MWTiL; KO_Vj: return Response::generateSuccess(); goto gfZbf; Ljuwd: $UiYds = null; goto MorAC; GmPvi: $Nw6ws = InputPackage::buildFromInput(); goto TSES2; kJACr: BizException::throwsIfEmpty('手机为空', $Pg57y['phone']); goto ukBbe; MWTiL: $Pg57y['name'] = $Nw6ws->getTrimString('name'); goto Ie7r5; N5CY6: $Pg57y['isDefault'] = $Nw6ws->getBoolean('isDefault'); goto sFeC1; ukBbe: BizException::throwsIfEmpty('地址为空', $Pg57y['area']); goto o95AP; KnNvO: $Pg57y['area'] = $Nw6ws->getTrimString('area'); goto ANZvo; gfZbf: } public function delete() { goto TzmKE; TzmKE: $Nw6ws = InputPackage::buildFromInput(); goto pPNFh; R6AMC: $UiYds = MemberAddressUtil::getUserAddress(MemberUser::id(), $M3rBS); goto XvbXg; GPdKi: MemberAddressUtil::delete($UiYds['id']); goto gDLCK; XvbXg: BizException::throwsIfEmpty('地址不存在', $UiYds); goto GPdKi; gDLCK: return Response::generateSuccess(); goto CC9mN; pPNFh: $M3rBS = $Nw6ws->getInteger('id'); goto R6AMC; CC9mN: } }