input('admin_id'); $ttl = $request->input('ttl'); $sign = $request->input('sign'); $redisKey = env('LOGIN_REDIS_KEY') . '-'. $userId; $randomKey = RedisModel::get($redisKey); if(!$randomKey){ $data = Controller::returnValue(['data' => '请重新登录'],4001); return new Response($data); } // RedisModel::expire($redisKey, 300); // 用户 $user = Users::find($userId); // 用户不存在或被删除,退回重新登录 if (empty($user)) { $data = Controller::returnValue(['data' => '请重新登录'],4001); return new Response($data); } if(Users::validSign($userId, $ttl, $randomKey, $sign) === false){ $data = Controller::returnValue(['data' => '登录失败,请重新登录'],4002); return new Response($data); } \Auth::setUser($user); return $next($request); } }