<?php
/*
 本代码由 口号帮 创建
 创建时间 2019-05-08 16:22:09
 技术支持 口号帮 
 严禁反编译、逆向等任何形式的侵权行为，违者将追究法律责任
*/

namespace App\Http\Middleware;use App\Models\Member;use App\Models\TokenDevice;use Closure;use Illuminate\Support\Facades\Log;use Illuminate\Support\Facades\Redis;class CheckToken{public function handle($request,Closure $next){$P2g0=(bool)$request->authentication;if($P2g0)goto P2gBodyx5;goto P2gNextx5;P2gBodyx5:$P2g0=(bool)$request->identifier;goto P2gx4;P2gNextx5:P2gx4:$P2g1=(bool)$P2g0;if($P2g1)goto P2gBodyx3;goto P2gNextx3;P2gBodyx3:$P2g1=(bool)Redis::exists('token:'.$request->identifier);goto P2gx2;P2gNextx3:P2gx2:if($P2g1)goto P2gBodyx6;goto P2gNextx6;P2gBodyx6:$result=Redis::get('token:'.$request->identifier);$P2g0=json_decode($result,true)['token']==$request->authentication;if($P2g0)goto P2gBodyx8;goto P2gNextx8;P2gBodyx8:$is_login=Member::where(['remember_token'=>$request->authentication])->first(['id','type']);if($is_login)goto P2gBodyxa;goto P2gNextxa;P2gBodyxa:$request->merge(['uid'=>$is_login->id,'type'=>$is_login->type]);return $next($request);goto P2gx9;P2gNextxa:P2gx9:return $next($request);goto P2gx7;P2gNextx8:$P2gAC0=array();$P2gAC0['code']=4001;$P2gAC0['info']='token认证失败';$P2gAC0['data']=null;return $P2gAC0;P2gx7:goto P2gx1;P2gNextx6:$P2gAC0=array();$P2gAC0['code']=4001;$P2gAC0['info']='token认证失败';$P2gAC0['data']=null;return $P2gAC0;P2gx1:}}
?>