内容安全审核
This commit is contained in:
		
							
								
								
									
										13
									
								
								schema/response_schema.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								schema/response_schema.py
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,13 @@ | ||||
| from typing import Optional, Any | ||||
|  | ||||
| from pydantic import BaseModel, Field | ||||
|  | ||||
|  | ||||
| class APIResponse(BaseModel): | ||||
|     """统一 API 响应模型(所有接口必返此格式)""" | ||||
|     code: int = Field(..., description="状态码: 200=成功、4xx=客户端错误、5xx=服务端错误") | ||||
|     message: str = Field(..., description="响应信息: 成功/错误描述") | ||||
|     data: Optional[Any] = Field(None, description="响应数据: 成功时返回、错误时为 None") | ||||
|  | ||||
|     # Pydantic V2 配置(支持从 ORM 对象转换) | ||||
|     model_config = {"from_attributes": True} | ||||
		Reference in New Issue
	
	Block a user