Files
meijiaka-zy/python-api/app/api/v1/system.py
T

44 lines
1.0 KiB
Python

"""
系统模块 API
============
"""
from fastapi import APIRouter
from app.schemas.common import ApiResponse, success_response
router = APIRouter()
@router.get("/health", response_model=ApiResponse[dict])
async def system_health():
"""系统健康检查(详细版)"""
return success_response(
data={
"status": "healthy",
"services": {
"api": "up",
"database": "unknown", # TODO: 检查数据库连接
"redis": "unknown", # TODO: 检查 Redis 连接
},
},
message="系统运行正常",
)
@router.get("/version", response_model=ApiResponse[dict])
async def system_version():
"""获取系统版本信息"""
from app.config import get_settings
settings = get_settings()
return success_response(
data={
"name": settings.APP_NAME,
"version": settings.APP_VERSION,
"environment": settings.ENV,
},
message="获取版本成功",
)