主要更新: - 更新代理商端文档,明确项目由品牌方分配流程 - 新增Brief配置详情页(已配置)设计稿 - 完善工作台紧急待办中品牌新任务功能 - 整理Pencil设计文件中代理商端页面顺序 - 新增后端FastAPI框架及核心API - 新增前端Next.js页面和组件库 - 添加.gitignore排除构建和缓存文件 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
55 lines
1.1 KiB
Python
55 lines
1.1 KiB
Python
"""健康检查 API"""
|
||
from fastapi import APIRouter, Depends
|
||
|
||
from app.config import settings
|
||
from app.services.health import HealthChecker, get_health_checker
|
||
|
||
router = APIRouter(tags=["health"])
|
||
|
||
|
||
@router.get("/health")
|
||
async def health_check():
|
||
"""
|
||
健康检查端点
|
||
|
||
Returns:
|
||
dict: 包含服务状态信息
|
||
"""
|
||
return {
|
||
"status": "healthy",
|
||
"service": settings.APP_NAME,
|
||
"version": settings.APP_VERSION,
|
||
}
|
||
|
||
|
||
@router.get("/health/ready")
|
||
async def readiness_check(
|
||
health_checker: HealthChecker = Depends(get_health_checker),
|
||
):
|
||
"""
|
||
就绪检查端点(用于 K8s)
|
||
检查数据库、Redis 等依赖服务是否就绪
|
||
|
||
Returns:
|
||
dict: 服务就绪状态和依赖检查结果
|
||
"""
|
||
checks = await health_checker.check_all()
|
||
all_ready = all(checks.values())
|
||
|
||
return {
|
||
"ready": all_ready,
|
||
"checks": checks,
|
||
}
|
||
|
||
|
||
@router.get("/health/live")
|
||
async def liveness_check():
|
||
"""
|
||
存活检查端点(用于 K8s)
|
||
只检查服务进程是否存活,不检查依赖
|
||
|
||
Returns:
|
||
dict: 服务存活状态
|
||
"""
|
||
return {"alive": True}
|