<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\App\Api\Middleware; use Illuminate\Http\Request; use Illuminate\Http\Response; use Illuminate\Support\Facades\Input; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Session; class SessionMiddleware { public function handle(Request $Kv_Mp, \Closure $SuXEo) { goto pznT1; cZov0: $bgMgO = $this->get($Kv_Mp, 'api-device'); goto lFPYP; jcbzH: $aziFu = $SuXEo($Kv_Mp); goto k9twS; SNYJi: if (empty($KicT5) || !Session::isValidId($KicT5)) { $KicT5 = Session::getId(); $govfn = true; } else { Session::setId($KicT5); $n_UF3 = true; } goto o6Z6e; ElMSp: $Kv_Mp->headers->set('api-param', $T7GMk); goto O0gfl; o6Z6e: $nbDxJ = Session::getId(); goto Z_qFX; k9twS: if ($govfn) { goto EJFtu; Rwgs6: $dw3aV = 'Symfony\\Component\\HttpFoundation\\Response'; goto mLVrI; EJFtu: $QbUfX = 'Illuminate\\Http\\Response'; goto Rwgs6; mLVrI: if ($aziFu instanceof $QbUfX) { $aziFu->header('api-token', $KicT5); } else { if ($aziFu instanceof $dw3aV) { $aziFu->headers->set('api-token', $KicT5); } } goto iaG4O; iaG4O: } goto a_wdT; YRwt5: if ($n_UF3) { Session::start(); } goto O2KJr; UzUf3: $KicT5 = $this->get($Kv_Mp, 'api-token'); goto SNYJi; O2KJr: $Kv_Mp->headers->set('api-token', $KicT5); goto cZov0; lFPYP: $Kv_Mp->headers->set('api-device', $bgMgO); goto j0EWy; x8QBy: $n_UF3 = false; goto UzUf3; a_wdT: return $aziFu; goto V3m9T; j0EWy: $T7GMk = $this->get($Kv_Mp, 'api-param'); goto ElMSp; O0gfl: $UeBgN = $this->get($Kv_Mp, 'api-version'); goto SVJmL; Z_qFX: if ($nbDxJ && $nbDxJ != $KicT5) { Session::setId($KicT5); $n_UF3 = true; } goto YRwt5; pznT1: $govfn = false; goto x8QBy; SVJmL: $Kv_Mp->headers->set('api-version', $UeBgN); goto jcbzH; V3m9T: } private function get(Request &$Kv_Mp, $oMJcb) { goto jIKU7; ZfOH2: $cBDsM = $Kv_Mp->header($oMJcb); goto ujuVF; h0oFa: if (!empty($cBDsM)) { return $cBDsM; } goto f38E_; ujuVF: if (!empty($cBDsM)) { return $cBDsM; } goto dUryW; dUryW: $cBDsM = $Kv_Mp->cookie($lH3ao); goto h0oFa; ZT4t4: $cBDsM = Input::get($lH3ao, null); goto VZ7it; VZ7it: if (!empty($cBDsM)) { return $cBDsM; } goto ZfOH2; jIKU7: $lH3ao = str_replace('-', '_', $oMJcb); goto ZT4t4; f38E_: return null; goto Oc7qP; Oc7qP: } private function getCookieSessionId(Request &$Kv_Mp) { return $Kv_Mp->cookie(config('session.cookie')); } }