🐛 修复sqlite下的日统计查询和0权限功能调用 (#1943)

This commit is contained in:
HibiKier
2025-07-11 10:07:23 +08:00
committed by GitHub
parent 579558e59b
commit 2921aed248
5 changed files with 34 additions and 18 deletions
+2 -1
View File
@@ -49,7 +49,8 @@ class ChatHistory(Model):
o = "-" if order == "DESC" else ""
query = cls.filter(group_id=gid) if gid else cls
if date_scope:
query = query.filter(create_time__range=date_scope)
filter_scope = (date_scope[0].isoformat(" "), date_scope[1].isoformat(" "))
query = query.filter(create_time__range=filter_scope)
return list(
await query.annotate(count=Count("user_id"))
.order_by(f"{o}count")