refactor: split some logic into util func

This commit is contained in:
2026-01-14 21:42:32 +08:00
parent 5a60e381d7
commit e842a9bc1d
14 changed files with 500 additions and 175 deletions
+3 -1
View File
@@ -189,7 +189,9 @@ async def get_system_stats(
# Token 即将过期的用户数(7天内)
# 使用 SQL 直接查询,避免 N+1 问题
current_timestamp = int(datetime.now().timestamp())
from backend.utils.time_helpers import now_timestamp
current_timestamp = now_timestamp()
expiring_soon_timestamp = current_timestamp + (7 * 24 * 60 * 60) # 7天后
# 直接在数据库层面筛选即将过期的用户