🐛 补充历史文件过期状态

This commit is contained in:
2026-06-05 16:18:17 +08:00
parent 5025228ad5
commit 87d8f522a6
+8
View File
@@ -299,6 +299,13 @@ async def analytics(start: str = "", end: str = ""):
def iso(value): def iso(value):
return value.isoformat() if value else "" return value.isoformat() if value else ""
def current_file_expired(file_item) -> bool:
if not file_item:
return False
if file_item.expired_at and file_item.expired_at < now:
return True
return file_item.expired_count == 0
def history_row(code: str, data: dict) -> dict: def history_row(code: str, data: dict) -> dict:
file_item = file_map.get(code) file_item = file_map.get(code)
current_name = "" current_name = ""
@@ -320,6 +327,7 @@ async def analytics(start: str = "", end: str = ""):
"upload_count": data.get("uploads") or 0, "upload_count": data.get("uploads") or 0,
"upload_traffic": str(data.get("uploadTraffic") or 0), "upload_traffic": str(data.get("uploadTraffic") or 0),
"current": bool(file_item), "current": bool(file_item),
"expired": current_file_expired(file_item),
"deleted": bool(data.get("deleted")) and not bool(file_item), "deleted": bool(data.get("deleted")) and not bool(file_item),
"created_at": iso(uploaded_at), "created_at": iso(uploaded_at),
"uploaded_at": iso(uploaded_at), "uploaded_at": iso(uploaded_at),