<?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 lZlOb; JpbTn: $qumIj = modstart_config('Member_MoneyCashMin', 100); goto CHtzp; lZlOb: $ahibX = MemberMoneyUtil::getTotal(MemberUser::id()); goto JpbTn; CHtzp: return Response::generateSuccessData(array('total' => $ahibX, 'desc' => modstart_config('Member_MoneyCashDescription'), 'min' => sprintf('%0.2f', $qumIj), 'rate' => modstart_config('Member_MoneyCashTaxRate', 0), 'types' => TypeUtil::dump(MemberMoneyCashType::class), 'canCash' => $ahibX >= $qumIj, 'defaultType' => MemberMoneyCashType::ALIPAY)); goto MHiYK; MHiYK: } public function calc() { goto PE24y; rG4xx: $ahibX = MemberMoneyUtil::getTotal(MemberUser::id()); goto aq5Dh; PE24y: $WZ8dY = InputPackage::buildFromInput(); goto DEWdD; aq5Dh: if ($MgvDM > $ahibX) { return Response::generateError('余额不足'); } goto XOYad; jANHP: $B1gdm = 100 - min(max($B1gdm, 0), 99); goto EjvJ4; XOYad: $B1gdm = modstart_config('Member_MoneyCashTaxRate', 0); goto jANHP; DEWdD: $MgvDM = $WZ8dY->getDecimal('money'); goto BGiXQ; K_FQr: return Response::generateSuccessData(array('value' => $fo71I)); goto wI3EU; EjvJ4: $fo71I = bcdiv(bcmul($MgvDM, $B1gdm, 2), 100, 2); goto K_FQr; BGiXQ: if ($MgvDM < modstart_config('Member_MoneyCashMin', 100)) { return Response::generateError('最小提现金额为' . modstart_config('Member_MoneyCashMin', 100)); } goto rG4xx; wI3EU: } public function submit() { goto YoHW2; sHqvF: $B1gdm = modstart_config('Member_MoneyCashTaxRate', 0); goto m0rpi; H4JKo: if ($ahibX < modstart_config('Member_MoneyCashMin', 100)) { return Response::generate(-1, '当前账户余额不满' . modstart_config('Member_MoneyCashMin', 100) . ',不能提现'); } goto sHqvF; I30_4: $MgvDM = $WZ8dY->getDecimal('money'); goto gFbZV; WEPi8: if ($MgvDM < modstart_config('Member_MoneyCashMin', 100)) { return Response::generate(-1, '提现金额至少为' . modstart_config('Member_MoneyCashMin', 100)); } goto Owi0f; gFbZV: if ($MgvDM < 0.01) { return Response::generate(-1, '提现金额不能为空'); } goto WEPi8; m0rpi: $B1gdm = 100 - min(max($B1gdm, 0), 99); goto IJ8Fj; CAlGU: switch ($EpKdG) { case MemberMoneyCashType::ALIPAY: goto j0bg8; mjg6y: if (empty($dzle_)) { return Response::generate(-1, '支付宝姓名不能为空'); } goto btgVo; j0bg8: $dzle_ = $WZ8dY->getTrimString('alipayRealname'); goto YACtU; EayW8: break; goto RNyH1; btgVo: if (empty($pOG1i)) { return Response::generate(-1, '支付宝账号不能为空'); } goto EayW8; YACtU: $pOG1i = $WZ8dY->getTrimString('alipayAccount'); goto mjg6y; RNyH1: default: return Response::generateError('支付类型错误'); } goto FMhaZ; YoHW2: if (!modstart_config('Member_MoneyCashEnable', false)) { return Response::generateError('功能未开启'); } goto a25kX; UD5gP: return Response::generate(0, '提交成功', null, modstart_web_url('member_money/cash/log')); goto vZ8Vj; a25kX: $WZ8dY = InputPackage::buildFromInput(); goto I30_4; FMhaZ: $ahibX = MemberMoneyUtil::getTotal(MemberUser::id()); goto H4JKo; IJ8Fj: $SFlsO = bcdiv(bcmul($MgvDM, $B1gdm, 2), 100, 2); goto GonXW; GonXW: try { goto khyRB; khyRB: ModelUtil::transactionBegin(); goto cM5zg; uiSYn: ModelUtil::transactionCommit(); goto pX7nZ; cM5zg: MemberMoneyUtil::cash(MemberUser::id(), $MgvDM, $SFlsO, MemberMoneyCashType::ALIPAY, $dzle_, $pOG1i); goto uiSYn; pX7nZ: } catch (\Exception $ZemkG) { ModelUtil::transactionRollback(); throw $ZemkG; } goto UD5gP; Owi0f: $EpKdG = $WZ8dY->getType('type', MemberMoneyCashType::class); goto CAlGU; vZ8Vj: } public function log() { goto BEUOZ; nwj82: $y6j27 = MemberMoneyUtil::paginateCash(MemberUser::id(), $WZ8dY->getPage(), $WZ8dY->getPageSize(), $iNhXN); goto McyDC; ALBk2: $iNhXN = array(); goto nwj82; BEUOZ: $WZ8dY = InputPackage::buildFromInput(); goto ALBk2; McyDC: return Response::generateSuccessPaginate($WZ8dY->getPage(), $WZ8dY->getPageSize(), $y6j27); goto PZcuB; PZcuB: } }