<?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 IdOWw; x6K93: $avcnU['subTitle'] = modstart_config('Member_VipSubTitle'); goto V3M27; H1rLO: $avcnU['vips'] = MemberVipUtil::allVisible(); goto QSuMm; BE3yt: return Response::generateSuccessData($avcnU); goto s25af; ZDJSH: $avcnU['title'] = modstart_config('Member_VipTitle'); goto x6K93; QSuMm: $avcnU['rights'] = MemberVipUtil::rights(); goto BE3yt; V3M27: $avcnU['content'] = modstart_config('Member_VipContent'); goto H1rLO; IdOWw: $avcnU = array(); goto ZDJSH; s25af: } public function all() { return Response::generateSuccessData(MemberVipUtil::allVisible()); } public function buy() { goto ZCsMB; XsKXy: BizException::throwsIf('请安装 PayCenter 模块', !modstart_module_enabled('PayCenter')); goto nbaKG; svNEo: if ($bdjvn['code']) { return Response::generateError($bdjvn['msg']); } goto l1m6V; XGfbU: $bdjvn = $this->calc($n2ZWE); goto svNEo; ZCsMB: $Km8YS = InputPackage::buildFromInput(); goto BX8YZ; j_bNZ: if (empty($VMzwF)) { return Response::generateError('请选择会员类型'); } goto XGfbU; nbaKG: $eQyQ4 = app(PayCenterPerform::class); goto fTeUW; BX8YZ: $n2ZWE = $Km8YS->getInteger('vipId'); goto rFyJn; FbNGl: $hNw1H = ModelUtil::insert('member_vip_order', array('status' => OrderStatus::WAIT_PAY, 'memberUserId' => MemberUser::id(), 'vipId' => $VMzwF['id'], 'payFee' => $k92oI, 'expire' => $bdjvn['data']['expire'], 'type' => $bdjvn['data']['type'])); goto XsKXy; rFyJn: if (empty($n2ZWE)) { return Response::generateError('请选择会员类型'); } goto Sh_8Y; fTeUW: return $eQyQ4->performSubmitOrder(MemberVipPayCenterBiz::NAME, $hNw1H['id'], $hNw1H['payFee'], '购买会员'); goto BwYsm; Sh_8Y: $VMzwF = MemberVipUtil::get($n2ZWE); goto j_bNZ; l1m6V: $k92oI = $bdjvn['data']['price']; goto yBK6u; yBK6u: if ($k92oI < 0.01) { return Response::generateError('支付金额为空0.01'); } goto FbNGl; BwYsm: } public function calc($n2ZWE = 0) { goto LS8GI; W69Hl: if ($rhLXE['code']) { return Response::generateError($rhLXE['msg']); } goto r58Nf; wsyUg: $rhLXE = MemberVipUtil::calcPrice($VMzwF ? $VMzwF['id'] : 0, MemberUser::get('vipExpire'), $n2ZWE); goto W69Hl; S5oZl: $VMzwF = MemberVip::get(); goto Jo9Ip; LS8GI: $Km8YS = InputPackage::buildFromInput(); goto grCxc; Jo9Ip: if (empty($n2ZWE)) { $n2ZWE = $Km8YS->getInteger('vipId'); } goto rfWiE; rfWiE: if (empty($n2ZWE)) { return Response::generateError('请选择会员'); } goto wsyUg; grCxc: if (MemberUser::isNotLogin()) { return Response::generate(0, 'ok', array('type' => '-', 'expire' => '-', 'price' => '-')); } goto S5oZl; r58Nf: return Response::generateSuccessData($rhLXE['data']); goto B3Bpf; B3Bpf: } }