客户信息删除代码更新
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
4. 中间件配置
|
||||
|
||||
作者: 项目团队
|
||||
版本: 1.0.0
|
||||
版本: 2.0.0
|
||||
"""
|
||||
from contextlib import asynccontextmanager
|
||||
from fastapi import FastAPI, Request, HTTPException, status
|
||||
@@ -90,7 +90,7 @@ async def lifespan(app: FastAPI):
|
||||
app = FastAPI(
|
||||
title="简道云FastAPI服务",
|
||||
description="简道云插件后端服务,提供数据同步和处理功能",
|
||||
version="1.0.0",
|
||||
version="2.0.0",
|
||||
lifespan=lifespan
|
||||
)
|
||||
|
||||
@@ -106,6 +106,26 @@ app.add_middleware(
|
||||
app.include_router(router)
|
||||
|
||||
|
||||
@app.get("/", tags=["系统"])
|
||||
async def root():
|
||||
"""
|
||||
根路径端点
|
||||
|
||||
返回服务基本信息和可用端点
|
||||
"""
|
||||
return {
|
||||
"service": "简道云FastAPI服务",
|
||||
"version": "2.0.0",
|
||||
"status": "running",
|
||||
"endpoints": {
|
||||
"health": "/health",
|
||||
"webhook": "/webhook",
|
||||
"docs": "/docs",
|
||||
"redoc": "/redoc"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@app.exception_handler(HTTPException)
|
||||
async def http_exception_handler(request: Request, exc: HTTPException):
|
||||
"""
|
||||
@@ -128,7 +148,7 @@ async def http_exception_handler(request: Request, exc: HTTPException):
|
||||
content=ErrorResponse(
|
||||
detail=exc.detail or "HTTP error",
|
||||
error_code=f"HTTP_{exc.status_code}"
|
||||
).dict(),
|
||||
).model_dump(),
|
||||
)
|
||||
|
||||
|
||||
@@ -154,7 +174,7 @@ async def validation_exception_handler(request: Request, exc: RequestValidationE
|
||||
content=ErrorResponse(
|
||||
detail="请求数据验证失败",
|
||||
error_code="VALIDATION_ERROR"
|
||||
).dict(),
|
||||
).model_dump(),
|
||||
)
|
||||
|
||||
|
||||
@@ -180,7 +200,7 @@ async def general_exception_handler(request: Request, exc: Exception):
|
||||
content=ErrorResponse(
|
||||
detail="服务器内部错误",
|
||||
error_code="INTERNAL_ERROR"
|
||||
).dict(),
|
||||
).model_dump(),
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user