From 6fa9d5ba796ea7aef6acc928ebf675ee82472474 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=92=95=E8=B0=B7=E9=85=B1?= <74496778+GooGuJiang@users.noreply.github.com> Date: Sun, 24 Aug 2025 06:17:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=86=E7=A0=81=E6=88=BF?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/router/lio.py | 2 -- app/router/v2/room.py | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/router/lio.py b/app/router/lio.py index cbbac1f..5a21563 100644 --- a/app/router/lio.py +++ b/app/router/lio.py @@ -490,8 +490,6 @@ async def _transfer_ownership_or_end_room(db: Database, room_id: int, leaving_us # 没有其他参与者,结束房间 return await _end_room_if_empty(db, room_id) - - # ===== API ENDPOINTS ===== @router.post("/multiplayer/rooms") diff --git a/app/router/v2/room.py b/app/router/v2/room.py index d41e640..5e8b970 100644 --- a/app/router/v2/room.py +++ b/app/router/v2/room.py @@ -59,7 +59,7 @@ async def get_all_rooms( if status is not None: where_clauses.append(col(Room.status) == status) - print(mode, category, status, current_user.id) + #print(mode, category, status, current_user.id) if mode == "open": # 修改为新的查询逻辑:状态为 idle 或 playing,starts_at 不为空,ends_at 为空 where_clauses.extend([ @@ -96,13 +96,13 @@ async def get_all_rooms( .unique() .all() ) - print("Retrieved rooms:", db_rooms) + #print("Retrieved rooms:", db_rooms) for room in db_rooms: resp = await RoomResp.from_db(room, db) + resp.has_password = bool((room.password or "").strip()) if category == RoomCategory.REALTIME: - mp_room = MultiplayerHubs.rooms.get(room.id) - resp.has_password = bool(mp_room.room.settings.password.strip()) if mp_room is not None else False resp.category = RoomCategory.NORMAL + resp_list.append(resp) return resp_list