feat: AI余额定时自动同步(CLI脚本+systemd每日timer+批量同步接口+前端按钮)
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
"""同步相关路由(批量同步操作)"""
|
||||
|
||||
from fastapi import APIRouter, Depends
|
||||
from sqlmodel import Session
|
||||
|
||||
from app.core.security import require_api_key
|
||||
from app.database import get_session
|
||||
from app.services import sync_service
|
||||
|
||||
router = APIRouter(prefix="/api/sync", tags=["sync"])
|
||||
|
||||
|
||||
@router.post(
|
||||
"/ai-balances",
|
||||
summary="同步所有 AI 账号余额",
|
||||
dependencies=[Depends(require_api_key)],
|
||||
)
|
||||
def sync_ai_balances(session: Session = Depends(get_session)) -> dict:
|
||||
return sync_service.sync_all_ai_balances(session)
|
||||
Reference in New Issue
Block a user