v1.2.54 - 修复stats接口过滤条件bug
This commit is contained in:
parent
e4ef142ad2
commit
88e734d6f7
|
|
@ -284,13 +284,8 @@ def get_stats(
|
|||
"""获取藏品统计 - 使用数据库聚合查询优化性能"""
|
||||
from sqlalchemy import case
|
||||
|
||||
# 基础查询条件
|
||||
if current_user.role == "admin":
|
||||
base_filter = True
|
||||
user_filter = True
|
||||
else:
|
||||
base_filter = Collection.f99_91_user_id == current_user.f99_90_id
|
||||
user_filter = Collection.f99_91_user_id == current_user.f99_90_id
|
||||
# 基础查询条件 - 管理员查看所有藏品,普通用户只看自己的
|
||||
base_filter = True if current_user.role == "admin" else Collection.f99_91_user_id == current_user.f99_90_id
|
||||
|
||||
# 总数 - 使用 COUNT
|
||||
total_count = db.query(func.count(Collection.f99_90_id)).filter(base_filter).scalar() or 0
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<title>甲辰收藏 v1.2.38</title>
|
||||
<title>甲辰收藏 v1.2.53</title>
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="icon" type="image/png" href="/static/icons/favicon.png" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue