<?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 vmctw; Kjjh4: $cwaKT['title'] = modstart_config('Member_VipTitle'); goto Suf6I; JYBiN: $cwaKT['rights'] = MemberVipUtil::rights(); goto T70u_; vmctw: $cwaKT = array(); goto Kjjh4; Suf6I: $cwaKT['subTitle'] = modstart_config('Member_VipSubTitle'); goto yebRS; yebRS: $cwaKT['content'] = modstart_config('Member_VipContent'); goto v6UYe; v6UYe: $cwaKT['vips'] = MemberVipUtil::all(); goto JYBiN; T70u_: return Response::generateSuccessData($cwaKT); goto pNATl; pNATl: } public function all() { return Response::generateSuccessData(MemberVipUtil::all()); } public function buy() { goto USv7R; KZEeF: $Ds6bM = $tBuXm->getInteger('vipId'); goto cFgWb; KTX_F: $zqE6E = $this->calc($Ds6bM); goto g0lKP; bhGum: $LKZdd = $zqE6E['data']['price']; goto bUwJ7; pN104: $dE3UR = app(PayCenterPerform::class); goto Z8DfM; g0lKP: if ($zqE6E['code']) { return Response::generateError($zqE6E['msg']); } goto bhGum; pZkbO: $GTydV = ModelUtil::insert('member_vip_order', array('status' => OrderStatus::WAIT_PAY, 'memberUserId' => MemberUser::id(), 'vipId' => $W6FTy['id'], 'payFee' => $LKZdd, 'expire' => $zqE6E['data']['expire'], 'type' => $zqE6E['data']['type'])); goto dbhcq; Ny0kI: if (empty($W6FTy)) { return Response::generateError('请选择会员类型'); } goto KTX_F; Z8DfM: return $dE3UR->performSubmitOrder(MemberVipPayCenterBiz::NAME, $GTydV['id'], $GTydV['payFee'], '购买会员'); goto KsHms; cFgWb: if (empty($Ds6bM)) { return Response::generateError('请选择会员类型'); } goto O94O6; dbhcq: BizException::throwsIf('请安装 PayCenter 模块', !modstart_module_enabled('PayCenter')); goto pN104; USv7R: $tBuXm = InputPackage::buildFromInput(); goto KZEeF; O94O6: $W6FTy = MemberVipUtil::get($Ds6bM); goto Ny0kI; bUwJ7: if ($LKZdd < 0.01) { return Response::generateError('支付金额为空0.01'); } goto pZkbO; KsHms: } public function calc($Ds6bM = 0) { goto woVX8; woVX8: $tBuXm = InputPackage::buildFromInput(); goto SxmgQ; SKGdk: return Response::generateSuccessData($ZrjxR['data']); goto qP1Hi; SxmgQ: if (MemberUser::isNotLogin()) { return Response::generate(0, 'ok', array('type' => '-', 'expire' => '-', 'price' => '-')); } goto hAv_N; jd8po: if (empty($Ds6bM)) { return Response::generateError('请选择会员'); } goto Ehi71; IQ7Ip: if (empty($Ds6bM)) { $Ds6bM = $tBuXm->getInteger('vipId'); } goto jd8po; Ehi71: $ZrjxR = MemberVipUtil::calcPrice($W6FTy ? $W6FTy['id'] : 0, MemberUser::get('vipExpire'), $Ds6bM); goto tfozt; hAv_N: $W6FTy = MemberVip::get(); goto IQ7Ip; tfozt: if ($ZrjxR['code']) { return Response::generateError($ZrjxR['msg']); } goto SKGdk; qP1Hi: } }