<?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 $hoJyG, \Closure $dkWaY) { goto A4Pr5; A4Pr5: $yrSu7 = false; goto jt5E8; gQ3x_: if ($rtwKV && $rtwKV != $WPvx6) { Session::setId($WPvx6); $FoGnD = true; } goto WzJCb; oriFP: $afcSo = $this->get($hoJyG, 'api-param'); goto Ie43R; Ie43R: $hoJyG->headers->set('api-param', $afcSo); goto Ri8Lo; InbSA: $hoJyG->headers->set('api-version', $gDBot); goto kUiYw; WzJCb: if ($FoGnD) { Session::start(); } goto CaXqn; L_yvt: $rtwKV = Session::getId(); goto gQ3x_; e93bJ: $hoJyG->headers->set('api-device', $JdTiu); goto oriFP; CaXqn: $hoJyG->headers->set('api-token', $WPvx6); goto vefuW; ydoMl: if (empty($WPvx6) || !Session::isValidId($WPvx6)) { $WPvx6 = Session::getId(); $yrSu7 = true; } else { Session::setId($WPvx6); $FoGnD = true; } goto L_yvt; vefuW: $JdTiu = $this->get($hoJyG, 'api-device'); goto e93bJ; bwY2p: $WPvx6 = $this->get($hoJyG, 'api-token'); goto ydoMl; BQZHL: return $FqOmX; goto J6adn; HhdCZ: if ($yrSu7) { goto sERur; eSkO2: if ($FqOmX instanceof $aV7iA) { $FqOmX->header('api-token', $WPvx6); } else { if ($FqOmX instanceof $LrTTK) { $FqOmX->headers->set('api-token', $WPvx6); } } goto ji3mE; sERur: $aV7iA = 'Illuminate\\Http\\Response'; goto P9jN1; P9jN1: $LrTTK = 'Symfony\\Component\\HttpFoundation\\Response'; goto eSkO2; ji3mE: } goto BQZHL; kUiYw: $FqOmX = $dkWaY($hoJyG); goto HhdCZ; jt5E8: $FoGnD = false; goto bwY2p; Ri8Lo: $gDBot = $this->get($hoJyG, 'api-version'); goto InbSA; J6adn: } private function get(Request &$hoJyG, $l6tBV) { goto Qmw2R; TU7s3: $Mczr_ = Input::get($hmxKO, null); goto Z_ALQ; KKOWv: if (!empty($Mczr_)) { return $Mczr_; } goto DY6IR; EeENk: return null; goto SGgUv; Z_ALQ: if (!empty($Mczr_)) { return $Mczr_; } goto gE4kk; Qmw2R: $hmxKO = str_replace('-', '_', $l6tBV); goto TU7s3; DY6IR: $Mczr_ = $hoJyG->cookie($hmxKO); goto J6kVg; J6kVg: if (!empty($Mczr_)) { return $Mczr_; } goto EeENk; gE4kk: $Mczr_ = $hoJyG->header($l6tBV); goto KKOWv; SGgUv: } private function getCookieSessionId(Request &$hoJyG) { return $hoJyG->cookie(config('session.cookie')); } }