<?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 YO49K; HL1jA: $U8wjN['subTitle'] = modstart_config('Member_VipSubTitle'); goto uV5s2; uV5s2: $U8wjN['content'] = modstart_config('Member_VipContent'); goto Xal0z; Xal0z: $U8wjN['vips'] = MemberVipUtil::all(); goto nkqCt; nkqCt: $U8wjN['rights'] = MemberVipUtil::rights(); goto RuEuR; YO49K: $U8wjN = array(); goto jH8dQ; RuEuR: return Response::generateSuccessData($U8wjN); goto E9RuW; jH8dQ: $U8wjN['title'] = modstart_config('Member_VipTitle'); goto HL1jA; E9RuW: } public function all() { return Response::generateSuccessData(MemberVipUtil::all()); } public function buy() { goto OY1FH; YWgPV: return $Ubb8m->performSubmitOrder(MemberVipPayCenterBiz::NAME, $xb5WS['id'], $xb5WS['payFee'], '购买会员'); goto r460r; uDfSF: if (empty($JTwKA)) { return Response::generateError('请选择会员类型'); } goto zH1pS; zH1pS: $yQVVz = MemberVipUtil::get($JTwKA); goto ITMIi; MyQ0I: if ($z4kS0['code']) { return Response::generateError($z4kS0['msg']); } goto XUPYu; owmgg: $Ubb8m = app(PayCenterPerform::class); goto YWgPV; n6cOT: $xb5WS = ModelUtil::insert('member_vip_order', array('status' => OrderStatus::WAIT_PAY, 'memberUserId' => MemberUser::id(), 'vipId' => $yQVVz['id'], 'payFee' => $MgvDM, 'expire' => $z4kS0['data']['expire'], 'type' => $z4kS0['data']['type'])); goto V0TYs; OY1FH: $WZ8dY = InputPackage::buildFromInput(); goto s0gZO; cWe9r: if ($MgvDM < 0.01) { return Response::generateError('支付金额为空0.01'); } goto n6cOT; V0TYs: BizException::throwsIf('请安装 PayCenter 模块', !modstart_module_enabled('PayCenter')); goto owmgg; XUPYu: $MgvDM = $z4kS0['data']['price']; goto cWe9r; ITMIi: if (empty($yQVVz)) { return Response::generateError('请选择会员类型'); } goto rFYgJ; s0gZO: $JTwKA = $WZ8dY->getInteger('vipId'); goto uDfSF; rFYgJ: $z4kS0 = $this->calc($JTwKA); goto MyQ0I; r460r: } public function calc($JTwKA = 0) { goto AQI3P; AE0m2: if (MemberUser::isNotLogin()) { return Response::generate(0, 'ok', array('type' => '-', 'expire' => '-', 'price' => '-')); } goto LYV32; LYV32: $yQVVz = MemberVip::get(); goto RJ0VQ; dJzAh: $Tbn6c = MemberVipUtil::calcPrice($yQVVz ? $yQVVz['id'] : 0, MemberUser::get('vipExpire'), $JTwKA); goto pMez7; RJ0VQ: if (empty($JTwKA)) { $JTwKA = $WZ8dY->getInteger('vipId'); } goto F2fNo; F2fNo: if (empty($JTwKA)) { return Response::generateError('请选择会员'); } goto dJzAh; AQI3P: $WZ8dY = InputPackage::buildFromInput(); goto AE0m2; LyO76: return Response::generateSuccessData($Tbn6c['data']); goto cFRdz; pMez7: if ($Tbn6c['code']) { return Response::generateError($Tbn6c['msg']); } goto LyO76; cFRdz: } }