<?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($jPfeB); public function handle($Mjv3h, \Closure $WExJt) { goto QaOuB; TOy1D: $eY6Yv = explode('@', $sMEbu); goto HYrkJ; N0FRT: if ($w4EDX != $mKyzr) { goto s_G32; s_G32: Log::info('MS.SignNotMatch : ' . $mKyzr); goto ydHoi; S99do: if ($f3Nqc['code']) { return $f3Nqc['data']; } goto l_7PB; ydHoi: $f3Nqc = $this->signNotMatch(); goto S99do; l_7PB: } goto CaTgT; TcY3s: $zIOpr = array('timestamp' => $kpbbP, 'key' => $jPfeB); goto gYuTu; VqEwv: if (($kpbbP < time() - 1800 || $kpbbP > time() + 1800) && empty($EjsH_['isDemo'])) { return Response::json(-1, 'timestamp not valid (' . time() . ')'); } goto PHQGh; jSIl7: Session::flash('_openApiKey', $jPfeB); goto v8MGH; gYuTu: $mKyzr = SignUtil::common($zIOpr, $mZanm); goto N0FRT; ZlEBT: if (isset($eY6Yv[1])) { $fOKL5 = $eY6Yv[1]; } else { $fOKL5 = null; } goto MjjNs; yKf4r: $jPfeB = Input::get('key'); goto hM7xV; hM7xV: if (empty($jPfeB)) { return Response::json(-1, 'key empty'); } goto q_als; aRIqw: if (empty($kpbbP)) { return Response::json(-1, 'timestamp empty'); } goto VqEwv; v8MGH: Session::flash('_openApiSecret', $mZanm); goto l7oA7; QaOuB: $w4EDX = Input::get('sign'); goto j1vmk; V3GGT: if (empty($mZanm)) { return Response::json(-1, 'invalid key'); } goto aRIqw; l7oA7: return $WExJt($Mjv3h); goto cSRFl; j1vmk: $kpbbP = Input::get('timestamp'); goto yKf4r; MjjNs: if (!Str::startsWith($Hn_H6, '\\')) { $Hn_H6 = '\\' . $Hn_H6; } goto jSIl7; CaTgT: $sMEbu = Route::currentRouteAction(); goto TOy1D; q_als: $mZanm = $this->getSecretByKey($jPfeB); goto V3GGT; HYrkJ: if (isset($eY6Yv[0])) { $Hn_H6 = $eY6Yv[0]; } else { $Hn_H6 = null; } goto ZlEBT; PHQGh: if (empty($w4EDX)) { return Response::json(-1, 'sign empty'); } goto TcY3s; cSRFl: } protected function signNotMatch() { return Response::generate(-1, 'sign error', Response::json(-1, 'sign error')); } }