<?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 NrL3e; W2zMn: $jrM9E = modstart_config('Member_MoneyCashMin', 100); goto ieqmg; NrL3e: $mAmuv = MemberMoneyUtil::getTotal(MemberUser::id()); goto W2zMn; ieqmg: return Response::generateSuccessData(array('total' => $mAmuv, 'desc' => modstart_config('Member_MoneyCashDescription'), 'min' => sprintf('%0.2f', $jrM9E), 'rate' => modstart_config('Member_MoneyCashTaxRate', 0), 'types' => TypeUtil::dump(MemberMoneyCashType::class), 'canCash' => $mAmuv >= $jrM9E, 'defaultType' => MemberMoneyCashType::ALIPAY)); goto yjTjm; yjTjm: } public function calc() { goto AuUm8; TNDta: $mAmuv = MemberMoneyUtil::getTotal(MemberUser::id()); goto G1iJ6; cl9d0: return Response::generateSuccessData(array('value' => $jkY57)); goto kprl9; G1iJ6: if ($k92oI > $mAmuv) { return Response::generateError('余额不足'); } goto ZxeBP; QMIvP: $k92oI = $Km8YS->getDecimal('money'); goto nZkKr; ZxeBP: $spcxY = modstart_config('Member_MoneyCashTaxRate', 0); goto DLx80; AuUm8: $Km8YS = InputPackage::buildFromInput(); goto QMIvP; afi2f: $jkY57 = bcdiv(bcmul($k92oI, $spcxY, 2), 100, 2); goto cl9d0; DLx80: $spcxY = 100 - min(max($spcxY, 0), 99); goto afi2f; nZkKr: if ($k92oI < modstart_config('Member_MoneyCashMin', 100)) { return Response::generateError('最小提现金额为' . modstart_config('Member_MoneyCashMin', 100)); } goto TNDta; kprl9: } public function submit() { goto NnIyJ; jiX3s: if ($k92oI < 0.01) { return Response::generate(-1, '提现金额不能为空'); } goto sElG1; NnIyJ: if (!modstart_config('Member_MoneyCashEnable', false)) { return Response::generateError('功能未开启'); } goto PW6Qi; kcoYh: $spcxY = modstart_config('Member_MoneyCashTaxRate', 0); goto eEhEr; YrEfi: $k92oI = $Km8YS->getDecimal('money'); goto jiX3s; sElG1: if ($k92oI < modstart_config('Member_MoneyCashMin', 100)) { return Response::generate(-1, '提现金额至少为' . modstart_config('Member_MoneyCashMin', 100)); } goto Mke9h; Mke9h: $HWA34 = $Km8YS->getType('type', MemberMoneyCashType::class); goto ZMkGM; eEhEr: $spcxY = 100 - min(max($spcxY, 0), 99); goto cNsaI; PtABM: try { goto mf93W; uPweG: ModelUtil::transactionCommit(); goto RpNXG; CPTnk: MemberMoneyUtil::cash(MemberUser::id(), $k92oI, $VsvAp, MemberMoneyCashType::ALIPAY, $p7pj3, $I7aRa); goto uPweG; mf93W: ModelUtil::transactionBegin(); goto CPTnk; RpNXG: } catch (\Exception $qoTNG) { ModelUtil::transactionRollback(); throw $qoTNG; } goto EJJEC; cNsaI: $VsvAp = bcdiv(bcmul($k92oI, $spcxY, 2), 100, 2); goto PtABM; EJJEC: return Response::generate(0, '提交成功', null, modstart_web_url('member_money/cash/log')); goto q4tFH; ZMkGM: switch ($HWA34) { case MemberMoneyCashType::ALIPAY: goto J_2et; TbOYf: if (empty($p7pj3)) { return Response::generate(-1, '支付宝姓名不能为空'); } goto y_tQx; y_tQx: if (empty($I7aRa)) { return Response::generate(-1, '支付宝账号不能为空'); } goto RW73D; RW73D: break; goto sA4wk; J_2et: $p7pj3 = $Km8YS->getTrimString('alipayRealname'); goto w2fGk; w2fGk: $I7aRa = $Km8YS->getTrimString('alipayAccount'); goto TbOYf; sA4wk: default: return Response::generateError('支付类型错误'); } goto LAhB3; LAhB3: $mAmuv = MemberMoneyUtil::getTotal(MemberUser::id()); goto BDW3g; BDW3g: if ($mAmuv < modstart_config('Member_MoneyCashMin', 100)) { return Response::generate(-1, '当前账户余额不满' . modstart_config('Member_MoneyCashMin', 100) . ',不能提现'); } goto kcoYh; PW6Qi: $Km8YS = InputPackage::buildFromInput(); goto YrEfi; q4tFH: } public function log() { goto txQ28; txQ28: $Km8YS = InputPackage::buildFromInput(); goto gkl2Q; Tcr5q: $fPAoT = MemberMoneyUtil::paginateCash(MemberUser::id(), $Km8YS->getPage(), $Km8YS->getPageSize(), $r2pbP); goto XAfze; gkl2Q: $r2pbP = array(); goto Tcr5q; XAfze: return Response::generateSuccessPaginate($Km8YS->getPage(), $Km8YS->getPageSize(), $fPAoT); goto voegR; voegR: } }