uid)) { try { if (!$auth = JWTAuth::parseToken()->authenticate()) { throw new JWTException("请先授权登陆", 401); } } catch (JWTException $e) { throw new JWTException("登陆已过期,请重新授权登陆", 401); } $debug_uid = Redis::hget("fpdx_admin_debug", $auth->uid); if (!empty($debug_uid)) { $uid = $debug_uid; } else { $uid = $auth->uid; } $this->uid = $uid; Config::set("uid", $this->uid); return $this->uid; } return $this->uid; } /** * @return mixed * @throws JWTException */ public static function adminAuth() { try { if (!$auth = JWTAuth::parseToken()->authenticate()) { throw new JWTException("请先授权登陆", 401); } } catch (JWTException $e) { throw new JWTException("登陆已过期,请重新授权登陆", 401); } $uid = $auth->uid; if (in_array($uid, self::ADMINS)) { return $uid; } else { throw new JWTException("权限不足", 403); } } }