From ac28f37a05f91c6664ef7ed64581ea041392ed93 Mon Sep 17 00:00:00 2001 From: nanfs <1272487263@qq.com> Date: Sat, 1 Feb 2025 23:54:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9Eapi.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/.vitepress/config.mts | 5 +-- docs/standard/summary/api.md | 56 ++++++++++++++++++++++++++++++ docs/standard/summary/auth-mark.md | 1 - docs/standard/summary/fields.md | 1 - 4 files changed, 57 insertions(+), 6 deletions(-) create mode 100644 docs/standard/summary/api.md delete mode 100644 docs/standard/summary/auth-mark.md delete mode 100644 docs/standard/summary/fields.md diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index a8e650a..0aa6fe9 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -54,10 +54,7 @@ export default defineConfig({ }, { text: "综合篇", - items: [ - { text: "字段", link: "/standard/summary/fields" }, - { text: "权限标识", link: "/standard/summary/auth-mark" }, - ], + items: [{ text: "接口相关", link: "/standard/summary/api" }], }, ], }, diff --git a/docs/standard/summary/api.md b/docs/standard/summary/api.md new file mode 100644 index 0000000..2c9e71a --- /dev/null +++ b/docs/standard/summary/api.md @@ -0,0 +1,56 @@ +# 接口相关 + + +请检查项目接口是否遵循以下约定,如有出入请务必修改保持一致。 + + +## 常用字段名约定 + +| 字段 | 说明 | 数据类型 | 备注 | +| ------------- | -------------- | ------------------- | ---------------------- | +| enabled | 启用状态 | `boolean` | | +| status | 记录状态 | `string` | | +| auditStatus | 审核状态 | `string` | | +| auditTime | 审核时间 | `string(date-time)` | YYYY-MM-DD HH:mm:ss | +| auditUsername | 审核人:用户名 | `string` | | +| auditRealname | 审核人:姓名 | `string` | | +| bizType | 业务类型 | `string` | 同接口区分不同业务类型 | + +## 权限标识 + +统一用 camelCase 法命名,多个单词首字母小写 + +``` +base:materialType:add +``` + +## 必填字段 + +接口文档中请务必标注需要**必填**的字段。 + +## 状态码 + +务必确保所有接口返回成功时,状态码为 `200`,如有特殊情况,请于接口文档单独注明。 + +## 错误信息 + +对于一些可预见的错误,请返回对应通俗易懂的错误信息,方便快速定位和排查问题。 + +## 响应体结构 + +除上传文件接口外,其他接口均返回此结构。 + +```json +{ + /** 状态码 */ + "code": 200, + /** 处理消息 */ + "message": "", + /** 数据对象 */ + "result": {}, + /** 成功标志 */ + "success": true, + /** 时间戳 */ + "timestamp": 1550000000000 +} +``` diff --git a/docs/standard/summary/auth-mark.md b/docs/standard/summary/auth-mark.md deleted file mode 100644 index 6ea7408..0000000 --- a/docs/standard/summary/auth-mark.md +++ /dev/null @@ -1 +0,0 @@ -# 权限标识 diff --git a/docs/standard/summary/fields.md b/docs/standard/summary/fields.md deleted file mode 100644 index 0f99107..0000000 --- a/docs/standard/summary/fields.md +++ /dev/null @@ -1 +0,0 @@ -# 字段约定