- 虚拟用户管理(昵称/头像/性别/简介/邮箱同步到目标平台) - AI互动调度(点赞/收藏/评论/转发) - 日志时间改为北京时间 - 评论达上限后继续执行点赞收藏转发 - 一键登出全部功能 - 浅色主题UI
26 lines
767 B
Python
26 lines
767 B
Python
"""数据看板接口"""
|
|
from fastapi import APIRouter, Depends, Query
|
|
from app.core.database import get_db
|
|
from app.schemas import ApiResponse
|
|
from app.services.stats_service import stats_service
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("")
|
|
async def get_dashboard(db=Depends(get_db)):
|
|
data = await stats_service.get_dashboard(db)
|
|
return ApiResponse(data=data)
|
|
|
|
|
|
@router.get("/token-trend")
|
|
async def get_token_trend(days: int = Query(default=30, ge=7, le=90), db=Depends(get_db)):
|
|
trend = await stats_service.get_token_trend(db, days)
|
|
return ApiResponse(data=trend)
|
|
|
|
|
|
@router.get("/monthly-token-trend")
|
|
async def get_monthly_token_trend(db=Depends(get_db)):
|
|
trend = await stats_service.get_monthly_token_trend(db)
|
|
return ApiResponse(data=trend)
|