<?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($VFU9l); public function handle($fzeTQ, \Closure $ayFRd) { goto hIbyv; l8BMe: if (empty($VFU9l)) { return Response::json(-1, 'key empty'); } goto akipi; CBHce: if (empty($XK2yJ)) { return Response::json(-1, 'timestamp empty'); } goto GrD5_; Ly9Fd: $UbqnB = array('timestamp' => $XK2yJ, 'key' => $VFU9l); goto OJfhB; QbAsD: $XK2yJ = Input::get('timestamp'); goto g9eoR; TvMug: return $ayFRd($fzeTQ); goto vx8zM; LKEkR: Session::flash('_openApiKey', $VFU9l); goto chWqv; Rs5nP: if (isset($f4xip[0])) { $qukc_ = $f4xip[0]; } else { $qukc_ = null; } goto ExGgo; icSm2: if ($IMKwh != $G3aam) { goto AXdxf; rApYY: if ($Z5nZL['code']) { return $Z5nZL['data']; } goto oGWew; ZIShK: $Z5nZL = $this->signNotMatch(); goto rApYY; AXdxf: Log::info('MS.SignNotMatch : ' . $G3aam); goto ZIShK; oGWew: } goto e1L4m; chWqv: Session::flash('_openApiSecret', $mGD19); goto TvMug; ExGgo: if (isset($f4xip[1])) { $x6cQE = $f4xip[1]; } else { $x6cQE = null; } goto SoWiI; g9eoR: $VFU9l = Input::get('key'); goto l8BMe; akipi: $mGD19 = $this->getSecretByKey($VFU9l); goto pC5R8; J78wV: $f4xip = explode('@', $wuAJG); goto Rs5nP; OJfhB: $G3aam = SignUtil::common($UbqnB, $mGD19); goto icSm2; hIbyv: $IMKwh = Input::get('sign'); goto QbAsD; GrD5_: if (($XK2yJ < time() - 1800 || $XK2yJ > time() + 1800) && empty($nMh7m['isDemo'])) { return Response::json(-1, 'timestamp not valid (' . time() . ')'); } goto oyBA2; oyBA2: if (empty($IMKwh)) { return Response::json(-1, 'sign empty'); } goto Ly9Fd; SoWiI: if (!Str::startsWith($qukc_, '\\')) { $qukc_ = '\\' . $qukc_; } goto LKEkR; e1L4m: $wuAJG = Route::currentRouteAction(); goto J78wV; pC5R8: if (empty($mGD19)) { return Response::json(-1, 'invalid key'); } goto CBHce; vx8zM: } protected function signNotMatch() { return Response::generate(-1, 'sign error', Response::json(-1, 'sign error')); } }