49 lines
1.0 KiB
Python
49 lines
1.0 KiB
Python
"""
|
|
系统模块 API
|
|
============
|
|
|
|
提供版本信息查询。
|
|
"""
|
|
|
|
import logging
|
|
|
|
from fastapi import APIRouter
|
|
|
|
from app.schemas.common import ApiResponse, success_response
|
|
|
|
logger = logging.getLogger(__name__)
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("/health", response_model=ApiResponse[dict])
|
|
async def health_check():
|
|
"""服务健康检查"""
|
|
from app.config import get_settings
|
|
|
|
settings = get_settings()
|
|
return success_response(
|
|
data={
|
|
"status": "healthy",
|
|
"version": settings.APP_VERSION,
|
|
"environment": settings.ENV,
|
|
},
|
|
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="获取版本成功",
|
|
)
|