<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\PayCenter\Web\Controller; use Illuminate\Support\Facades\Session; use ModStart\Core\Dao\ModelUtil; use ModStart\Core\Exception\BizException; use ModStart\Core\Input\InputPackage; use ModStart\Core\Input\Request; use ModStart\Core\Input\Response; use ModStart\Module\ModuleBaseController; use Module\PayCenter\Biz\PayCenterBiz; use Module\PayCenter\Support\PayCenterPerform; use Module\PayCenter\Type\PayOrderQuickStatus; use Module\PayCenter\Type\PayOrderStatus; use Module\PayCenter\Util\PayOrderUtil; class PayController extends ModuleBaseController { private $api; public function __construct() { $this->api = app(\Module\PayCenter\Api\Controller\PayController::class); } public function index() { goto MwVwv; Sh3uV: return $this->view('pay.index', array('order' => $HsIf6, 'autoClickPayType' => $aH01y)); goto QnP_h; f1HAH: $aH01y = Session::get('autoClickPayType', null); goto ZTJCi; ZTJCi: Session::forget('autoClickPayType'); goto Sh3uV; haFkB: if (Request::isPost()) { return Response::jsonFromGenerate($this->api->submit($HsIf6, $SRq1z['orderSecretId'])); } goto lJ1zM; ynbok: $HsIf6 = $SRq1z['order']; goto haFkB; MwVwv: $SRq1z = Response::tryGetData($this->api->info()); goto ynbok; CwF2c: if ($iU3m_ >= 0 && $iU3m_ <= 0) { goto T9tUB; kVeoe: BizException::throwsIfResponseError($Tbn6c); goto ubS4X; ubS4X: $C30Ed = empty($Tbn6c['data']['order']['redirect']) ? modstart_web_url('') : $Tbn6c['data']['order']['redirect']; goto jdkRX; T9tUB: $Tbn6c = PayOrderUtil::autoPay($HsIf6['biz'], $HsIf6['bizId'], 0); goto kVeoe; jdkRX: return Response::send(0, null, null, $C30Ed); goto M2z2T; M2z2T: } goto f1HAH; lJ1zM: $iU3m_ = floatval($SRq1z['order']['feeTotal']); goto CwF2c; QnP_h: } public function watch() { goto wB8_e; dzguN: switch ($HsIf6['status']) { case PayOrderStatus::NEW_ORDER: case PayOrderStatus::CREATED: return Response::generate(0, null, array('status' => 'new')); case PayOrderStatus::PAYED: return Response::generate(0, null, array('status' => 'payed')); case PayOrderStatus::CLOSED: return Response::generate(0, null, array('status' => 'expired')); default: return Response::generate(-1, 'order status error'); } goto Z0Y9H; wB8_e: $SRq1z = Response::tryGetData($this->api->info()); goto VxgU_; VxgU_: $HsIf6 = $SRq1z['order']; goto dzguN; Z0Y9H: } public function quick($KDkZr) { goto anHLZ; TNKV8: return $this->view('pay.quick', array('payUrl' => $qZT4K, 'order' => $HsIf6)); goto nDAH0; anHLZ: BizException::throwsIfEmpty('参数sn错误', $KDkZr); goto svmLQ; XhqPi: try { goto bRlQn; JLMY5: BizException::throwsIf('订单不存在', $tdo8n['code'] != $nGvLi); goto v9RDv; s3POa: ModelUtil::transactionCommit(); goto IcVit; bRlQn: $tdo8n = ModelUtil::getWithLock('pay_order_quick', $ULYbu); goto SDcGC; v9RDv: if ($tdo8n['status'] == PayOrderQuickStatus::NEW_ORDER) { goto wA2ex; O1SUd: ModelUtil::update('pay_order_quick', $tdo8n['id'], array('status' => PayOrderQuickStatus::CREATED, 'orderId' => $HsIf6['id'])); goto yK2YZ; oBZsH: BizException::throwsIfEmpty('支付业务不存在', $qhsmj); goto rr69l; s8m6A: $HsIf6 = PayOrderUtil::getOrder($oLjMM['data']['orderSecretId']); goto MIs9Z; ZjKb1: BizException::throwsIfResponseError($Tbn6c); goto vlFKM; gi2TD: BizException::throwsIfEmpty('支付业务创建订单失败', $Tbn6c); goto ZjKb1; vlFKM: $Ubb8m = app(PayCenterPerform::class); goto D1Shb; LehtD: BizException::throwsIfResponseError($oLjMM); goto s8m6A; rr69l: $Tbn6c = $qhsmj->createOrderForQuick($tdo8n); goto gi2TD; MIs9Z: BizException::throwsIfEmpty('订单不存在', $HsIf6); goto O1SUd; wA2ex: ModelUtil::decodeRecordJson($tdo8n, array('param', 'session')); goto o9bGn; yK2YZ: $qZT4K = $oLjMM['data']['payUrl']; goto BvEMK; D1Shb: if (isset($Tbn6c['data']['redirect'])) { InputPackage::mergeToInput('redirect', $Tbn6c['data']['redirect']); } goto Z3VBy; o9bGn: $qhsmj = PayCenterBiz::get($tdo8n['biz']); goto oBZsH; Z3VBy: $oLjMM = $Ubb8m->performSubmitOrder($qhsmj->name(), $Tbn6c['data']['bizId'], $Tbn6c['data']['feeTotal'], $Tbn6c['data']['body'], array('ShowSuccessPage' => true)); goto LehtD; BvEMK: } else { goto Z0W6j; WfXlg: $qoQHX = PayOrderUtil::getOrderSecretId($HsIf6['id']); goto pALIX; pALIX: $qZT4K = modstart_web_url('pay', array('order' => $qoQHX)); goto m3tVv; DQTxd: BizException::throwsIfEmpty('订单不存在', $HsIf6); goto WfXlg; Z0W6j: $HsIf6 = PayOrderUtil::get($tdo8n['orderId']); goto DQTxd; m3tVv: } goto s3POa; SDcGC: BizException::throwsIfEmpty('订单不存在', $tdo8n); goto JLMY5; IcVit: } catch (BizException $ZemkG) { ModelUtil::transactionRollback(); return Response::sendError($ZemkG->getMessage()); } goto TNKV8; wjHKm: ModelUtil::transactionBegin(); goto XhqPi; w9TGb: BizException::throwsIfEmpty('参数sn错误', $ULYbu); goto PjAPe; PjAPe: BizException::throwsIfEmpty('参数sn错误', $nGvLi); goto wjHKm; svmLQ: list($ULYbu, $nGvLi) = explode('_', $KDkZr); goto w9TGb; nDAH0: } public function success() { return $this->view('pay.success', array()); } }