Spaces:
Runtime error
Runtime error
File size: 638 Bytes
c4753aa 2b4d36e c4753aa 1c34af9 2b4d36e 1c34af9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | """访问统计 API(仅管理员可用)"""
from backend.platform.visit_stats import get_active_visits_timeline, get_stats_snapshot, reset_delta_base
from backend.api.utils import require_admin
@require_admin
def get_visit_stats():
return get_stats_snapshot(), 200
@require_admin
def get_visit_stats_active_visits_timeline():
body = get_active_visits_timeline()
status = 200 if body.get("success") else 503
return body, status
@require_admin
def post_visit_stats_reset():
if reset_delta_base():
return {"success": True}, 200
return {"success": False, "error": "Failed to persist reset base"}, 500
|