<?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($m1RYi); public function handle($kn_5b, \Closure $BuCHd) { goto SSL9M; K5gpd: if ($fJLzJ != $mNLRy) { goto QJBmY; QJBmY: Log::info('sign not match : ' . $mNLRy); goto mWnGL; mWnGL: $uotzZ = $this->signNotMatch(); goto nZVWx; nZVWx: if ($uotzZ['code']) { return $uotzZ['data']; } goto JhX73; JhX73: } goto AU5mM; SSL9M: $fJLzJ = Input::get('sign'); goto VC7xO; dNufw: Session::flash('_openApiKey', $m1RYi); goto aubxy; AU5mM: $COAft = Route::currentRouteAction(); goto iKPfW; cl_1h: $mNLRy = SignUtil::common($iq6Gr, $DTnLH); goto K5gpd; iKPfW: $HGZG4 = explode('@', $COAft); goto dzSRR; higvv: return $BuCHd($kn_5b); goto Xfw3k; gSYcV: if (empty($DTnLH)) { return Response::json(-1, 'invalid key'); } goto M0Oq1; dzSRR: if (isset($HGZG4[0])) { $clsTY = $HGZG4[0]; } else { $clsTY = null; } goto fDRIB; VC7xO: $PVm_Y = Input::get('timestamp'); goto Weez3; RjFoe: $iq6Gr = array('timestamp' => $PVm_Y, 'key' => $m1RYi); goto cl_1h; fDRIB: if (isset($HGZG4[1])) { $TFjGK = $HGZG4[1]; } else { $TFjGK = null; } goto AL1Uz; M0Oq1: if (empty($PVm_Y)) { return Response::json(-1, 'timestamp empty'); } goto EhqOg; fvuWB: if (empty($m1RYi)) { return Response::json(-1, 'key empty'); } goto JVy3z; gHRKY: if (empty($fJLzJ)) { return Response::json(-1, 'sign empty'); } goto RjFoe; JVy3z: $DTnLH = $this->getSecretByKey($m1RYi); goto gSYcV; aubxy: Session::flash('_openApiSecret', $DTnLH); goto higvv; Weez3: $m1RYi = Input::get('key'); goto fvuWB; EhqOg: if (($PVm_Y < time() - 1800 || $PVm_Y > time() + 1800) && empty($fqvxa['isDemo'])) { return Response::json(-1, 'timestamp not valid (' . time() . ')'); } goto gHRKY; AL1Uz: if (!Str::startsWith($clsTY, '\\')) { $clsTY = '\\' . $clsTY; } goto dNufw; Xfw3k: } protected function signNotMatch() { return Response::generate(-1, 'sign error', Response::json(-1, 'sign error')); } }