<?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 ModStart\Core\Util\SerializeUtil; use Module\PayCenter\Provider\PayCenterProvider; use Module\PayCenter\Type\PayType; use Module\PayCenter\Util\PayOrderUtil; class ReturnController extends Controller { private function redirectForOrder($v9Xk2) { goto Os2UH; Os2UH: $w6bW5 = @json_decode($v9Xk2['param'], true); goto m2TX3; m2TX3: $Ix_Nr = $v9Xk2['redirect']; goto J103x; gT4jw: return Response::redirect($Ix_Nr); goto wBhkD; J103x: if (!empty($w6bW5['ShowSuccessPage'])) { $Ix_Nr = modstart_web_url('pay/success'); } goto gT4jw; wBhkD: } public function index($gDyzf = '') { $Km8YS = InputPackage::buildFromInput(); switch ($gDyzf) { case PayType::ALIPAY: goto YI671; rI59F: switch (Input::get('trade_status')) { case 'TRADE_SUCCESS': case 'TRADE_FINISHED': goto FFIrW; dIysn: $B5OyZ = $Km8YS->getTrimString('trade_no'); goto EuBEC; FFIrW: $rbm7s = $Km8YS->getTrimString('out_trade_no'); goto dIysn; liI0p: if ($rhLXE['code']) { return Response::send(-1, '支付失败:' . $rhLXE['msg']); } goto nk2bA; JHWXi: $rhLXE = PayOrderUtil::handleOrderPay(PayType::ALIPAY, $rbm7s, array('payOrderId' => $B5OyZ)); goto liI0p; EuBEC: Log::info('PayCenter.ReturnController - alipay return - data verification success - ' . SerializeUtil::jsonEncode(array('out_trade_no' => $rbm7s, 'trade_no' => $B5OyZ))); goto JHWXi; nk2bA: return $this->redirectForOrder($rhLXE['data']['order']); goto QGuxp; QGuxp: } goto wgsIh; YI671: PayOrderUtil::initAlipay(); goto r__6L; wgsIh: return Response::send(-1, '支付失败'); goto vEZEi; r__6L: if (!app('alipay.web')->verify()) { Log::info('PayCenter.ReturnController - alipay return - query data verification fail - ' . SerializeUtil::jsonEncode(array('data' => Request::getQueryString()))); return Response::send(-1, '支付失败:-1'); } goto rI59F; vEZEi: case PayType::ALIPAY_WEB: case PayType::ALIPAY_MOBILE: goto C_T_A; C_T_A: $rbm7s = $Km8YS->getTrimString('out_trade_no'); goto qfVki; qfVki: $rhLXE = PayOrderUtil::getOrderByOutTradeNo($rbm7s); goto JsxPO; ckUAX: return $this->redirectForOrder($rhLXE['data']['order']); goto lEWQP; JsxPO: BizException::throwsIfResponseError($rhLXE); goto ckUAX; lEWQP: default: goto mM14Y; mM14Y: $tDnAb = PayCenterProvider::get($gDyzf); goto yFdae; yFdae: BizException::throwsIfEmpty('PayTypeProviderEmpty - ' . $gDyzf, $tDnAb); goto TGh_N; TGh_N: return $tDnAb->onReturn($gDyzf, $Km8YS->all()); goto Pp2rE; Pp2rE: } } }