mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-03-02 15:50:54 +08:00
docs(readme): 更新 API 响应风格兼容说明
This commit is contained in:
@@ -18,8 +18,51 @@
|
||||
|
||||
该仓库使用vben5开发,采用分包目录结构, 具体开发路径为: `根目录/apps/web-antd`
|
||||
|
||||
**后端需要开启”furion格式的规范化api“**:路径在Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs
|
||||
前端已同时兼容 **Furion 规范化 API 响应** 和 **ABP 风格响应**,可通过 `apps/web-antd/.env` 中的 `VITE_GLOB_API_STYLE` 配置响应风格:`auto`(默认)、`furion`、`abp`。
|
||||
|
||||
如果使用 Furion 规范化响应,可在 `Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs` 中开启相关配置。
|
||||
|
||||
**Furion风格示例**
|
||||
|
||||
````json
|
||||
{
|
||||
"statusCode": 200,
|
||||
"data": {"name": "大橙子","age": 20},
|
||||
"succeeded": true,
|
||||
"errors": null,
|
||||
"extras": null,
|
||||
"timestamp": 1770825190
|
||||
}
|
||||
````
|
||||
**ABP风格示例**
|
||||
|
||||
````json
|
||||
// 成功响应
|
||||
{ "name": "大橙子","age": 20}
|
||||
````
|
||||
````json
|
||||
// 异常响应
|
||||
{
|
||||
"error": {
|
||||
"code": "string",
|
||||
"message": "string",
|
||||
"details": "string",
|
||||
"data": {
|
||||
"additionalProp1": "string",
|
||||
"additionalProp2": "string",
|
||||
"additionalProp3": "string"
|
||||
},
|
||||
"validationErrors": [
|
||||
{
|
||||
"message": "string",
|
||||
"members": [
|
||||
"string"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
````
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user