fix: Stats接口用户认证检查
This commit is contained in:
parent
bb30f0e711
commit
2a8dea6acf
|
|
@ -284,7 +284,10 @@ def get_stats(
|
|||
"""获取藏品统计 - 使用数据库聚合查询优化性能"""
|
||||
from sqlalchemy import func, case
|
||||
|
||||
# 基础查询条件
|
||||
# 基础查询条件 - 检查用户是否登录
|
||||
if current_user is None or not hasattr(current_user, 'role'):
|
||||
base_filter = False # 未登录用户不能查看任何藏品
|
||||
else:
|
||||
base_filter = True if current_user.role == "admin" else Collection.f99_91_user_id == current_user.f99_90_id
|
||||
|
||||
# 总数
|
||||
|
|
|
|||
Loading…
Reference in New Issue