<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Member\Api\Controller; use Illuminate\Routing\Controller; use ModStart\Core\Dao\ModelUtil; use ModStart\Core\Exception\BizException; use ModStart\Core\Input\InputPackage; use ModStart\Core\Input\Response; use Module\Member\Auth\MemberUser; use Module\Member\Auth\MemberVip; use Module\Member\Core\MemberVipPayCenterBiz; use Module\Member\Support\MemberLoginCheck; use Module\Member\Util\MemberVipUtil; use Module\PayCenter\Support\PayCenterPerform; use Module\Vendor\Type\OrderStatus; class MemberVipController extends Controller implements MemberLoginCheck { public static $memberLoginCheckIgnores = array('info', 'calc'); public function info() { goto ItfBX; QkVZy: $Pg57y['rights'] = MemberVipUtil::rights(); goto CVXF8; ItfBX: $Pg57y = array(); goto huhFQ; RTyUo: $Pg57y['vips'] = MemberVipUtil::all(); goto QkVZy; CuQ5H: $Pg57y['subTitle'] = modstart_config('Member_VipSubTitle'); goto lOUl8; CVXF8: return Response::generateSuccessData($Pg57y); goto d3sjL; huhFQ: $Pg57y['title'] = modstart_config('Member_VipTitle'); goto CuQ5H; lOUl8: $Pg57y['content'] = modstart_config('Member_VipContent'); goto RTyUo; d3sjL: } public function all() { return Response::generateSuccessData(MemberVipUtil::all()); } public function buy() { goto NKYwW; EiHrz: $wYwbH = $this->calc($AkQUn); goto iQQ9p; TzO4H: $AkQUn = $Nw6ws->getInteger('vipId'); goto uC4qR; padk9: BizException::throwsIf('请安装 PayCenter 模块', !modstart_module_enabled('PayCenter')); goto X0fYz; OcnYi: if ($oLfec < 0.01) { return Response::generateError('支付金额为空0.01'); } goto Sno0x; KZHua: if (empty($IjI3r)) { return Response::generateError('请选择会员类型'); } goto EiHrz; uC4qR: if (empty($AkQUn)) { return Response::generateError('请选择会员类型'); } goto TvQST; qP8n_: return $c_u4c->performSubmitOrder(MemberVipPayCenterBiz::NAME, $LZDeJ['id'], $LZDeJ['payFee'], '购买会员'); goto XoEPA; NKYwW: $Nw6ws = InputPackage::buildFromInput(); goto TzO4H; oAJdG: $oLfec = $wYwbH['data']['price']; goto OcnYi; iQQ9p: if ($wYwbH['code']) { return Response::generateError($wYwbH['msg']); } goto oAJdG; TvQST: $IjI3r = MemberVipUtil::get($AkQUn); goto KZHua; X0fYz: $c_u4c = app(PayCenterPerform::class); goto qP8n_; Sno0x: $LZDeJ = ModelUtil::insert('member_vip_order', array('status' => OrderStatus::WAIT_PAY, 'memberUserId' => MemberUser::id(), 'vipId' => $IjI3r['id'], 'payFee' => $oLfec, 'expire' => $wYwbH['data']['expire'], 'type' => $wYwbH['data']['type'])); goto padk9; XoEPA: } public function calc($AkQUn = 0) { goto i_24V; PnP58: if ($Ecj99['code']) { return Response::generateError($Ecj99['msg']); } goto yx_25; mFJoJ: if (empty($AkQUn)) { return Response::generateError('请选择会员'); } goto h6ApX; VZ16O: $IjI3r = MemberVip::get(); goto tqNUZ; i_24V: $Nw6ws = InputPackage::buildFromInput(); goto NGDTN; NGDTN: if (MemberUser::isNotLogin()) { return Response::generate(0, 'ok', array('type' => '-', 'expire' => '-', 'price' => '-')); } goto VZ16O; yx_25: return Response::generateSuccessData($Ecj99['data']); goto RzgPx; h6ApX: $Ecj99 = MemberVipUtil::calcPrice($IjI3r ? $IjI3r['id'] : 0, MemberUser::get('vipExpire'), $AkQUn); goto PnP58; tqNUZ: if (empty($AkQUn)) { $AkQUn = $Nw6ws->getInteger('vipId'); } goto mFJoJ; RzgPx: } }