<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Member\Api\Controller; use Illuminate\Routing\Controller; use ModStart\Core\Dao\ModelUtil; use ModStart\Core\Input\InputPackage; use ModStart\Core\Input\Response; use ModStart\Core\Type\TypeUtil; use Module\Member\Auth\MemberUser; use Module\Member\Support\MemberLoginCheck; use Module\Member\Type\MemberMoneyCashType; use Module\Member\Util\MemberMoneyUtil; class MemberMoneyCashController extends Controller implements MemberLoginCheck { public function get() { goto hOy5T; mOwSj: $KcZbY = modstart_config('Member_MoneyCashMin', 100); goto WamP5; hOy5T: $t5RO9 = MemberMoneyUtil::getTotal(MemberUser::id()); goto mOwSj; WamP5: return Response::generateSuccessData(array('total' => $t5RO9, 'desc' => modstart_config('Member_MoneyCashDescription'), 'min' => sprintf('%0.2f', $KcZbY), 'rate' => modstart_config('Member_MoneyCashTaxRate', 0), 'types' => TypeUtil::dump(MemberMoneyCashType::class), 'canCash' => $t5RO9 >= $KcZbY, 'defaultType' => MemberMoneyCashType::ALIPAY)); goto kNXti; kNXti: } public function calc() { goto ywyf3; ywyf3: $tBuXm = InputPackage::buildFromInput(); goto EQ1nv; gc0bo: if ($LKZdd < modstart_config('Member_MoneyCashMin', 100)) { return Response::generateError('最小提现金额为' . modstart_config('Member_MoneyCashMin', 100)); } goto cx3Oi; EQ1nv: $LKZdd = $tBuXm->getDecimal('money'); goto gc0bo; bN9Bb: return Response::generateSuccessData(array('value' => $qQcPQ)); goto T7y2N; cx3Oi: $t5RO9 = MemberMoneyUtil::getTotal(MemberUser::id()); goto teBLb; k4WwJ: $c6nsi = 100 - min(max($c6nsi, 0), 99); goto B7BDf; teBLb: if ($LKZdd > $t5RO9) { return Response::generateError('余额不足'); } goto FgO4C; FgO4C: $c6nsi = modstart_config('Member_MoneyCashTaxRate', 0); goto k4WwJ; B7BDf: $qQcPQ = bcdiv(bcmul($LKZdd, $c6nsi, 2), 100, 2); goto bN9Bb; T7y2N: } public function submit() { goto HQ3lP; HQ3lP: if (!modstart_config('Member_MoneyCashEnable', false)) { return Response::generateError('功能未开启'); } goto wepVD; FknpN: $c6nsi = 100 - min(max($c6nsi, 0), 99); goto FHZya; Ym9et: if ($t5RO9 < modstart_config('Member_MoneyCashMin', 100)) { return Response::generate(-1, '当前账户余额不满' . modstart_config('Member_MoneyCashMin', 100) . ',不能提现'); } goto ktqF4; z9ePX: $AIxhN = $tBuXm->getType('type', MemberMoneyCashType::class); goto J3kh9; riU_x: try { goto bpVOo; bpVOo: ModelUtil::transactionBegin(); goto Wf05S; Wf05S: MemberMoneyUtil::cash(MemberUser::id(), $LKZdd, $eAxdj, MemberMoneyCashType::ALIPAY, $xogds, $gO1_L); goto Ko8Vt; Ko8Vt: ModelUtil::transactionCommit(); goto V_078; V_078: } catch (\Exception $RWZxh) { ModelUtil::transactionRollback(); throw $RWZxh; } goto VtqtO; VtqtO: return Response::generate(0, '提交成功', null, modstart_web_url('member_money/cash/log')); goto CpMHC; wepVD: $tBuXm = InputPackage::buildFromInput(); goto enW47; EEJaE: if ($LKZdd < modstart_config('Member_MoneyCashMin', 100)) { return Response::generate(-1, '提现金额至少为' . modstart_config('Member_MoneyCashMin', 100)); } goto z9ePX; ktqF4: $c6nsi = modstart_config('Member_MoneyCashTaxRate', 0); goto FknpN; QDdyG: $t5RO9 = MemberMoneyUtil::getTotal(MemberUser::id()); goto Ym9et; tLap0: if ($LKZdd < 0.01) { return Response::generate(-1, '提现金额不能为空'); } goto EEJaE; FHZya: $eAxdj = bcdiv(bcmul($LKZdd, $c6nsi, 2), 100, 2); goto riU_x; enW47: $LKZdd = $tBuXm->getDecimal('money'); goto tLap0; J3kh9: switch ($AIxhN) { case MemberMoneyCashType::ALIPAY: goto LxXH3; f04A2: if (empty($gO1_L)) { return Response::generate(-1, '支付宝账号不能为空'); } goto fOB0X; auYm1: if (empty($xogds)) { return Response::generate(-1, '支付宝姓名不能为空'); } goto f04A2; LxXH3: $xogds = $tBuXm->getTrimString('alipayRealname'); goto gjA2X; gjA2X: $gO1_L = $tBuXm->getTrimString('alipayAccount'); goto auYm1; fOB0X: break; goto fouwW; fouwW: default: return Response::generateError('支付类型错误'); } goto QDdyG; CpMHC: } public function log() { goto GIUcy; pAona: $Nv2EE = MemberMoneyUtil::paginateCash(MemberUser::id(), $tBuXm->getPage(), $tBuXm->getPageSize(), $f2U49); goto XaNDf; XaNDf: return Response::generateSuccessPaginate($tBuXm->getPage(), $tBuXm->getPageSize(), $Nv2EE); goto dOQn4; vx696: $f2U49 = array(); goto pAona; GIUcy: $tBuXm = InputPackage::buildFromInput(); goto vx696; dOQn4: } }