$request->header('token')]); $token = $request->header('token'); try { $user = UserFacade::findLoginBy($token); Auth::login(new GenericUser( array( 'id'=>$user->getData()->data->uid, 'password'=>"123456", 'remember_token'=>$token ) )); UserFacade::setLog($typeName.'查找用户结果', $startTime, [$user->getData()]); } catch (\Exception $e) { $auth = [ 'code' => 1006, 'data' => [ 'ip' => $request->ip(), 'token' => $request->header('token') ], 'msg' => '登陆验证失败,重新登陆' ]; UserFacade::setLog($typeName.'失败', $startTime, [$auth]); return response()->json($auth); } return $next($request); } }