<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\PayCenter\Web\Controller; use Illuminate\Routing\Controller; use Illuminate\Support\Facades\Input; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Request; use ModStart\Core\Exception\BizException; use ModStart\Core\Input\InputPackage; use ModStart\Core\Input\Response; use Module\PayCenter\Provider\PayCenterProvider; use Module\PayCenter\Type\PayType; use Module\PayCenter\Util\PayOrderUtil; class ReturnController extends Controller { private function redirectForOrder($MZHZc) { goto u6pBd; u6pBd: $KJ3xr = @json_decode($MZHZc['param'], true); goto HdbGR; Wq5jr: if (!empty($KJ3xr['ShowSuccessPage'])) { $uBQi3 = modstart_web_url('pay/success'); } goto X6wl9; X6wl9: return Response::redirect($uBQi3); goto EjhLn; HdbGR: $uBQi3 = $MZHZc['redirect']; goto Wq5jr; EjhLn: } public function index($xN3qr = '') { $Ylazq = InputPackage::buildFromInput(); switch ($xN3qr) { case PayType::ALIPAY: goto R3xVI; paY3R: if (!app('alipay.web')->verify()) { Log::info('PayCenter.ReturnController - alipay return - query data verification fail - ' . json_encode(array('data' => Request::getQueryString()))); return Response::send(-1, '支付失败:-1'); } goto hY8Wx; R3xVI: PayOrderUtil::initAlipay(); goto paY3R; afARe: return Response::send(-1, '支付失败'); goto ETfC5; hY8Wx: switch (Input::get('trade_status')) { case 'TRADE_SUCCESS': case 'TRADE_FINISHED': goto IBphQ; GOGDv: if ($Gs3Xd['code']) { return Response::send(-1, '支付失败:' . $Gs3Xd['msg']); } goto Lan04; RV25U: $Gs3Xd = PayOrderUtil::handleOrderPay(PayType::ALIPAY, $JhXYY, array('payOrderId' => $gsJZj)); goto GOGDv; IfCZy: $gsJZj = $Ylazq->getTrimString('trade_no'); goto Mgf8I; Mgf8I: Log::info('PayCenter.ReturnController - alipay return - data verification success - ' . json_encode(array('out_trade_no' => $JhXYY, 'trade_no' => $gsJZj))); goto RV25U; IBphQ: $JhXYY = $Ylazq->getTrimString('out_trade_no'); goto IfCZy; Lan04: return $this->redirectForOrder($Gs3Xd['data']['order']); goto xl0qE; xl0qE: } goto afARe; ETfC5: case PayType::ALIPAY_WEB: case PayType::ALIPAY_MOBILE: goto CZ_1B; ILFjA: BizException::throwsIfResponseError($Gs3Xd); goto nnUAR; A3u73: $Gs3Xd = PayOrderUtil::getOrderByOutTradeNo($JhXYY); goto ILFjA; CZ_1B: $JhXYY = $Ylazq->getTrimString('out_trade_no'); goto A3u73; nnUAR: return $this->redirectForOrder($Gs3Xd['data']['order']); goto wjCf0; wjCf0: default: goto cPqqY; cPqqY: $sefXk = PayCenterProvider::get($xN3qr); goto G6G3m; G6G3m: BizException::throwsIfEmpty('PayTypeProviderEmpty - ' . $xN3qr, $sefXk); goto lbZlL; lbZlL: return $sefXk->onReturn($xN3qr, $Ylazq->all()); goto mKbvz; mKbvz: } } }