<?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($rvTrU); public function handle($cSn43, \Closure $aPZzJ) { goto v1P5c; tXhRO: if (empty($rvTrU)) { return Response::json(-1, 'key empty'); } goto Z0j78; tbSaI: Session::flash('_openApiSecret', $STVWD); goto lBQ83; zgVIA: if (empty($AYE7s)) { return Response::json(-1, 'sign empty'); } goto Rpu2b; K40FM: Session::flash('_openApiKey', $rvTrU); goto tbSaI; YvEeQ: if ($AYE7s != $mi5zQ) { goto WLkJW; mQ7j8: if ($UdQ1p['code']) { return $UdQ1p['data']; } goto iRkNX; WLkJW: Log::info('MS.SignNotMatch : ' . $mi5zQ); goto sZ0F0; sZ0F0: $UdQ1p = $this->signNotMatch(); goto mQ7j8; iRkNX: } goto p039v; Z38eR: $Ra2yb = explode('@', $nZRNd); goto MMNpf; p039v: $nZRNd = Route::currentRouteAction(); goto Z38eR; P7KV0: $mi5zQ = SignUtil::common($CCHgz, $STVWD); goto YvEeQ; MMNpf: if (isset($Ra2yb[0])) { $WuRqa = $Ra2yb[0]; } else { $WuRqa = null; } goto p_9mO; v1P5c: $AYE7s = Input::get('sign'); goto AZT07; Rpu2b: $CCHgz = array('timestamp' => $Fcarx, 'key' => $rvTrU); goto P7KV0; AZT07: $Fcarx = Input::get('timestamp'); goto r_F3R; Z0j78: $STVWD = $this->getSecretByKey($rvTrU); goto MJ_aA; MJ_aA: if (empty($STVWD)) { return Response::json(-1, 'invalid key'); } goto bWtPo; bWtPo: if (empty($Fcarx)) { return Response::json(-1, 'timestamp empty'); } goto pr0JD; pr0JD: if (($Fcarx < time() - 1800 || $Fcarx > time() + 1800) && empty($ydjv3['isDemo'])) { return Response::json(-1, 'timestamp not valid (' . time() . ')'); } goto zgVIA; lBQ83: return $aPZzJ($cSn43); goto VlRD0; r_F3R: $rvTrU = Input::get('key'); goto tXhRO; FN4wv: if (!Str::startsWith($WuRqa, '\\')) { $WuRqa = '\\' . $WuRqa; } goto K40FM; p_9mO: if (isset($Ra2yb[1])) { $NaoVl = $Ra2yb[1]; } else { $NaoVl = null; } goto FN4wv; VlRD0: } protected function signNotMatch() { return Response::generate(-1, 'sign error', Response::json(-1, 'sign error')); } }