<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\App\OpenApi\Middleware; use Illuminate\Support\Facades\Input; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Session; use Illuminate\Support\Str; use ModStart\Core\Input\Response; use ModStart\Core\Util\SignUtil; abstract class AbstractKeySecretSimpleSignCheckMiddleware { protected abstract function getSecretByKey($oMJcb); public function handle($Kv_Mp, \Closure $SuXEo) { goto EnB1q; wXs5O: if (!Str::startsWith($Jq8UX, '\\')) { $Jq8UX = '\\' . $Jq8UX; } goto BXDkY; PqWWB: if (empty($YyV6N)) { return Response::json(-1, 'timestamp empty'); } goto BZNgD; rDY2M: if (isset($quDEW[1])) { $rjCDI = $quDEW[1]; } else { $rjCDI = null; } goto wXs5O; hFFqo: if (isset($quDEW[0])) { $Jq8UX = $quDEW[0]; } else { $Jq8UX = null; } goto rDY2M; gIbC7: Session::flash('_openApiSecret', $XCTFj); goto wGNNB; BXDkY: Session::flash('_openApiKey', $oMJcb); goto gIbC7; sig2d: $sgeM_ = array('timestamp' => $YyV6N, 'key' => $oMJcb); goto e6JJl; cyQR2: $XCTFj = $this->getSecretByKey($oMJcb); goto m0EDn; m0EDn: if (empty($XCTFj)) { return Response::json(-1, 'invalid key'); } goto PqWWB; p1XIv: if (empty($oMJcb)) { return Response::json(-1, 'key empty'); } goto cyQR2; ohaAM: if ($IPTJ8 != $XaOcL) { goto FgmJU; FgmJU: Log::info('MS.SignNotMatch : ' . $XaOcL); goto A2aYW; A2aYW: $bCCWW = $this->signNotMatch(); goto fTn9p; fTn9p: if ($bCCWW['code']) { return $bCCWW['data']; } goto q28cT; q28cT: } goto IHxKH; ySn3x: $quDEW = explode('@', $JfLuA); goto hFFqo; e6JJl: $XaOcL = SignUtil::common($sgeM_, $XCTFj); goto ohaAM; R5f_b: $oMJcb = Input::get('key'); goto p1XIv; EnB1q: $IPTJ8 = Input::get('sign'); goto oLUuM; WV4Iq: if (empty($IPTJ8)) { return Response::json(-1, 'sign empty'); } goto sig2d; oLUuM: $YyV6N = Input::get('timestamp'); goto R5f_b; IHxKH: $JfLuA = Route::currentRouteAction(); goto ySn3x; BZNgD: if (($YyV6N < time() - 1800 || $YyV6N > time() + 1800) && empty($GlToM['isDemo'])) { return Response::json(-1, 'timestamp not valid (' . time() . ')'); } goto WV4Iq; wGNNB: return $SuXEo($Kv_Mp); goto tuwAf; tuwAf: } protected function signNotMatch() { return Response::generate(-1, 'sign error', Response::json(-1, 'sign error')); } }