From 47e18948f1f4adf24dbdacfc9298582bf8643102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B2=E8=BE=B0=E7=94=9F=E4=BA=A7?= Date: Wed, 8 Apr 2026 14:41:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0images=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/routers/collections.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/backend/app/routers/collections.py b/backend/app/routers/collections.py index 8479da6..cfad289 100644 --- a/backend/app/routers/collections.py +++ b/backend/app/routers/collections.py @@ -133,10 +133,6 @@ def get_collections( from sqlalchemy.orm import joinedload # 管理员默认查看全库,普通用户只看自己 - if current_user is None: - return {"error": "Unauthorized", "totalCount": 0} - - # 获取所有藏品 if current_user.role == "admin": # 联表查询获取用户名 query = db.query(Collection, User.f01_01_name.label('owner_name')).join( @@ -206,11 +202,7 @@ def get_collections( data_list = [] for item in data: # 处理联表查询结果 - if current_user is None: - return {"error": "Unauthorized", "totalCount": 0} - - # 获取所有藏品 - if current_user.role == "admin": + if current_user.role == "admin": collection_item, owner_name = item else: collection_item = item @@ -285,10 +277,6 @@ def get_stats( db: Session = Depends(get_db) ): """获取藏品统计""" - # 获取所有藏品 - if current_user is None: - return {"error": "Unauthorized", "totalCount": 0} - # 获取所有藏品 if current_user.role == "admin": all_collections = db.query(Collection).all()