<?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($HsIf6) { goto oMjHh; oMjHh: $qOrzw = @json_decode($HsIf6['param'], true); goto ulKYq; phTrj: if (!empty($qOrzw['ShowSuccessPage'])) { $C30Ed = modstart_web_url('pay/success'); } goto YemUR; ulKYq: $C30Ed = $HsIf6['redirect']; goto phTrj; YemUR: return Response::redirect($C30Ed); goto JPKY8; JPKY8: } public function index($ri8KE = '') { $WZ8dY = InputPackage::buildFromInput(); switch ($ri8KE) { case PayType::ALIPAY: goto zxy3M; A6gh_: 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 Sav6m; Sav6m: switch (Input::get('trade_status')) { case 'TRADE_SUCCESS': case 'TRADE_FINISHED': goto XsgUJ; PT1fJ: if ($Tbn6c['code']) { return Response::send(-1, '支付失败:' . $Tbn6c['msg']); } goto u_Uc9; XsgUJ: $MM40Z = $WZ8dY->getTrimString('out_trade_no'); goto jo4ME; EHAcE: $Tbn6c = PayOrderUtil::handleOrderPay(PayType::ALIPAY, $MM40Z, array('payOrderId' => $Bsa6u)); goto PT1fJ; u_Uc9: return $this->redirectForOrder($Tbn6c['data']['order']); goto HtynF; uXeAT: Log::info('PayCenter.ReturnController - alipay return - data verification success - ' . json_encode(array('out_trade_no' => $MM40Z, 'trade_no' => $Bsa6u))); goto EHAcE; jo4ME: $Bsa6u = $WZ8dY->getTrimString('trade_no'); goto uXeAT; HtynF: } goto N4hpq; N4hpq: return Response::send(-1, '支付失败'); goto dqoNS; zxy3M: PayOrderUtil::initAlipay(); goto A6gh_; dqoNS: case PayType::ALIPAY_WEB: case PayType::ALIPAY_MOBILE: goto U2DUq; g42zS: $Tbn6c = PayOrderUtil::getOrderByOutTradeNo($MM40Z); goto jEi3N; jEi3N: BizException::throwsIfResponseError($Tbn6c); goto Fr2fd; Fr2fd: return $this->redirectForOrder($Tbn6c['data']['order']); goto psEMZ; U2DUq: $MM40Z = $WZ8dY->getTrimString('out_trade_no'); goto g42zS; psEMZ: default: goto V1wEv; afE9A: return $oMd7I->onReturn($ri8KE, $WZ8dY->all()); goto a5kIv; AprOQ: BizException::throwsIfEmpty('PayTypeProviderEmpty - ' . $ri8KE, $oMd7I); goto afE9A; V1wEv: $oMd7I = PayCenterProvider::get($ri8KE); goto AprOQ; a5kIv: } } }