<?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($l6tBV); public function handle($hoJyG, \Closure $dkWaY) { goto w940_; w940_: $Pmdhe = Input::get('sign'); goto Da0Ku; ul4I1: if (empty($PmxdV)) { return Response::json(-1, 'timestamp empty'); } goto KBa4x; Sdc28: $xD6dl = SignUtil::common($foKec, $DH19U); goto GEnoE; Bdzxy: if (empty($Pmdhe)) { return Response::json(-1, 'sign empty'); } goto m91mF; yOLJ_: $l6tBV = Input::get('key'); goto DCEOn; Da0Ku: $PmxdV = Input::get('timestamp'); goto yOLJ_; exKqj: if (empty($DH19U)) { return Response::json(-1, 'invalid key'); } goto ul4I1; wnLIM: $o0oy0 = explode('@', $ziOie); goto p5t8d; DCEOn: if (empty($l6tBV)) { return Response::json(-1, 'key empty'); } goto ZkJE9; GEnoE: if ($Pmdhe != $xD6dl) { goto K6WdV; CdilP: $ZIe4d = $this->signNotMatch(); goto dY1w0; K6WdV: Log::info('MS.SignNotMatch : ' . $xD6dl); goto CdilP; dY1w0: if ($ZIe4d['code']) { return $ZIe4d['data']; } goto mxXAH; mxXAH: } goto h_Jit; m91mF: $foKec = array('timestamp' => $PmxdV, 'key' => $l6tBV); goto Sdc28; Fz55F: if (!Str::startsWith($tIaKc, '\\')) { $tIaKc = '\\' . $tIaKc; } goto dRaYg; dRaYg: Session::flash('_openApiKey', $l6tBV); goto k8b_6; y3xdq: if (isset($o0oy0[1])) { $CoQTC = $o0oy0[1]; } else { $CoQTC = null; } goto Fz55F; k8b_6: Session::flash('_openApiSecret', $DH19U); goto NSH1b; KBa4x: if (($PmxdV < time() - 1800 || $PmxdV > time() + 1800) && empty($n_p0_['isDemo'])) { return Response::json(-1, 'timestamp not valid (' . time() . ')'); } goto Bdzxy; ZkJE9: $DH19U = $this->getSecretByKey($l6tBV); goto exKqj; p5t8d: if (isset($o0oy0[0])) { $tIaKc = $o0oy0[0]; } else { $tIaKc = null; } goto y3xdq; h_Jit: $ziOie = Route::currentRouteAction(); goto wnLIM; NSH1b: return $dkWaY($hoJyG); goto VhmmE; VhmmE: } protected function signNotMatch() { return Response::generate(-1, 'sign error', Response::json(-1, 'sign error')); } }