<?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($GUcFO); public function handle($RDnT0, \Closure $LeO9R) { goto q3xwS; INRmf: if ($qNzEK != $jb5rP) { goto DAwQg; vwVPj: $gbVzz = $this->signNotMatch(); goto vpMIJ; vpMIJ: if ($gbVzz['code']) { return $gbVzz['data']; } goto IAxc1; DAwQg: Log::info('MS.SignNotMatch : ' . $jb5rP); goto vwVPj; IAxc1: } goto R1WVb; q3xwS: $qNzEK = Input::get('sign'); goto XKG4E; Rddum: if (empty($qNzEK)) { return Response::json(-1, 'sign empty'); } goto n0VVE; Fhfws: return $LeO9R($RDnT0); goto ObUlq; lWIOe: if (isset($h5J44[1])) { $smhhv = $h5J44[1]; } else { $smhhv = null; } goto sXfxt; qaLvV: $jb5rP = SignUtil::common($DUFkV, $SsJ23); goto INRmf; Vewq6: $h5J44 = explode('@', $UvPUF); goto IEQE1; Tr9IG: if (empty($TRQ03)) { return Response::json(-1, 'timestamp empty'); } goto hyFWP; Tgm7N: if (empty($SsJ23)) { return Response::json(-1, 'invalid key'); } goto Tr9IG; hyFWP: if (($TRQ03 < time() - 1800 || $TRQ03 > time() + 1800) && empty($ZcLd1['isDemo'])) { return Response::json(-1, 'timestamp not valid (' . time() . ')'); } goto Rddum; IEQE1: if (isset($h5J44[0])) { $In6yO = $h5J44[0]; } else { $In6yO = null; } goto lWIOe; RavtH: $GUcFO = Input::get('key'); goto wyRhI; n0VVE: $DUFkV = array('timestamp' => $TRQ03, 'key' => $GUcFO); goto qaLvV; ilKeW: $SsJ23 = $this->getSecretByKey($GUcFO); goto Tgm7N; sXfxt: if (!Str::startsWith($In6yO, '\\')) { $In6yO = '\\' . $In6yO; } goto wDJ1q; wyRhI: if (empty($GUcFO)) { return Response::json(-1, 'key empty'); } goto ilKeW; wDJ1q: Session::flash('_openApiKey', $GUcFO); goto jbOSJ; R1WVb: $UvPUF = Route::currentRouteAction(); goto Vewq6; XKG4E: $TRQ03 = Input::get('timestamp'); goto RavtH; jbOSJ: Session::flash('_openApiSecret', $SsJ23); goto Fhfws; ObUlq: } protected function signNotMatch() { return Response::generate(-1, 'sign error', Response::json(-1, 'sign error')); } }