feat: 更新 API 响应结构,统一使用 statusCode 和 errMsg 替代 code 和 msg;新增用户类型和公司 ID 字段;优化数据库索引;添加公司所有者同步测试脚本
This commit is contained in:
@@ -40,13 +40,13 @@ components:
|
||||
schemas:
|
||||
ApiResponse:
|
||||
type: object
|
||||
required: [code, msg, data]
|
||||
required: [statusCode, errMsg, data]
|
||||
properties:
|
||||
code:
|
||||
statusCode:
|
||||
type: integer
|
||||
description: "业务状态码"
|
||||
example: 200
|
||||
msg:
|
||||
errMsg:
|
||||
type: string
|
||||
description: "业务提示信息"
|
||||
example: 操作成功
|
||||
@@ -343,13 +343,13 @@ components:
|
||||
type: object
|
||||
description: |
|
||||
项目统一认证响应。
|
||||
所有对外接口统一返回 `code`、`msg`、`data`,认证成功时额外返回顶层 `token`。
|
||||
所有对外接口统一返回 `statusCode`、`errMsg`、`data`,认证成功时额外返回顶层 `token`。
|
||||
properties:
|
||||
code:
|
||||
statusCode:
|
||||
type: integer
|
||||
description: "业务状态码"
|
||||
example: 200
|
||||
msg:
|
||||
errMsg:
|
||||
type: string
|
||||
description: "业务提示信息"
|
||||
example: 登录成功
|
||||
@@ -370,8 +370,8 @@ components:
|
||||
type: string
|
||||
description: "PocketBase 原生 auth token;仅认证类接口在成功时额外返回"
|
||||
example:
|
||||
code: 200
|
||||
msg: 登录成功
|
||||
statusCode: 200
|
||||
errMsg: 登录成功
|
||||
data:
|
||||
status: 登录或注册状态 | string
|
||||
is_info_complete: 资料是否完整 | boolean
|
||||
@@ -450,6 +450,14 @@ components:
|
||||
type: string
|
||||
description: "可选。未传 `users_phone_code` 时,可直接写入手机号"
|
||||
example: '13800138000'
|
||||
users_type:
|
||||
type: string
|
||||
description: "可选。用户类型;仅在传入非空值时更新"
|
||||
example: 服务商
|
||||
company_id:
|
||||
type: string
|
||||
description: "可选。公司业务 id;仅在传入非空值时更新"
|
||||
example: WX-COMPANY-10001
|
||||
users_tag:
|
||||
type: string
|
||||
description: "可选。用户标签;非空时才更新"
|
||||
@@ -1194,13 +1202,8 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/ApiResponse'
|
||||
- type: object
|
||||
properties:
|
||||
data:
|
||||
description: "业务响应数据"
|
||||
$ref: '#/components/schemas/HelloWorldData'
|
||||
description: "业务响应数据"
|
||||
$ref: '#/components/schemas/HelloWorldData'
|
||||
/pb/api/system/health:
|
||||
post:
|
||||
tags: [系统]
|
||||
@@ -1211,13 +1214,8 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/ApiResponse'
|
||||
- type: object
|
||||
properties:
|
||||
data:
|
||||
description: "业务响应数据"
|
||||
$ref: '#/components/schemas/HealthData'
|
||||
description: "业务响应数据"
|
||||
$ref: '#/components/schemas/HealthData'
|
||||
/pb/api/system/users-count:
|
||||
post:
|
||||
tags: [系统]
|
||||
@@ -1229,13 +1227,8 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/ApiResponse'
|
||||
- type: object
|
||||
properties:
|
||||
data:
|
||||
description: "业务响应数据"
|
||||
$ref: '#/components/schemas/UsersCountData'
|
||||
description: "业务响应数据"
|
||||
$ref: '#/components/schemas/UsersCountData'
|
||||
/pb/api/platform/register:
|
||||
post:
|
||||
tags: [平台认证]
|
||||
@@ -1292,8 +1285,8 @@ paths:
|
||||
schema:
|
||||
$ref: '#/components/schemas/PocketBaseAuthResponse'
|
||||
example:
|
||||
code: 200
|
||||
msg: 登录成功
|
||||
statusCode: 200
|
||||
errMsg: 登录成功
|
||||
data:
|
||||
status: login_success
|
||||
is_info_complete: false
|
||||
@@ -1348,18 +1341,13 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/ApiResponse'
|
||||
- type: object
|
||||
properties:
|
||||
data:
|
||||
description: "业务响应数据"
|
||||
type: object
|
||||
properties:
|
||||
items:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/DictionaryRecord'
|
||||
description: "业务响应数据"
|
||||
type: object
|
||||
properties:
|
||||
items:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/DictionaryRecord'
|
||||
'415':
|
||||
description: "请求体必须为 application/json"
|
||||
/pb/api/dictionary/detail:
|
||||
@@ -1382,13 +1370,8 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/ApiResponse'
|
||||
- type: object
|
||||
properties:
|
||||
data:
|
||||
description: "业务响应数据"
|
||||
$ref: '#/components/schemas/DictionaryRecord'
|
||||
description: "业务响应数据"
|
||||
$ref: '#/components/schemas/DictionaryRecord'
|
||||
'400':
|
||||
description: "参数错误"
|
||||
'404':
|
||||
@@ -1415,13 +1398,8 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/ApiResponse'
|
||||
- type: object
|
||||
properties:
|
||||
data:
|
||||
description: "业务响应数据"
|
||||
$ref: '#/components/schemas/DictionaryRecord'
|
||||
description: "业务响应数据"
|
||||
$ref: '#/components/schemas/DictionaryRecord'
|
||||
'400':
|
||||
description: "参数错误或 dict_name 已存在"
|
||||
'401':
|
||||
@@ -1451,13 +1429,8 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/ApiResponse'
|
||||
- type: object
|
||||
properties:
|
||||
data:
|
||||
description: "业务响应数据"
|
||||
$ref: '#/components/schemas/DictionaryRecord'
|
||||
description: "业务响应数据"
|
||||
$ref: '#/components/schemas/DictionaryRecord'
|
||||
'400':
|
||||
description: "参数错误或 dict_name 冲突"
|
||||
'401':
|
||||
@@ -1489,17 +1462,12 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/ApiResponse'
|
||||
- type: object
|
||||
properties:
|
||||
data:
|
||||
description: "业务响应数据"
|
||||
type: object
|
||||
properties:
|
||||
dict_name:
|
||||
description: "字典名称,当前按全局唯一维护"
|
||||
type: string
|
||||
description: "业务响应数据"
|
||||
type: object
|
||||
properties:
|
||||
dict_name:
|
||||
description: "字典名称,当前按全局唯一维护"
|
||||
type: string
|
||||
'400':
|
||||
description: "参数错误或删除失败"
|
||||
'401':
|
||||
@@ -1531,18 +1499,13 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/ApiResponse'
|
||||
- type: object
|
||||
properties:
|
||||
data:
|
||||
description: "业务响应数据"
|
||||
type: object
|
||||
properties:
|
||||
items:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/AttachmentRecord'
|
||||
description: "业务响应数据"
|
||||
type: object
|
||||
properties:
|
||||
items:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/AttachmentRecord'
|
||||
'401':
|
||||
description: "token 无效或已过期"
|
||||
'403':
|
||||
@@ -1568,13 +1531,8 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/ApiResponse'
|
||||
- type: object
|
||||
properties:
|
||||
data:
|
||||
description: "业务响应数据"
|
||||
$ref: '#/components/schemas/AttachmentRecord'
|
||||
description: "业务响应数据"
|
||||
$ref: '#/components/schemas/AttachmentRecord'
|
||||
'400':
|
||||
description: "参数错误"
|
||||
'401':
|
||||
@@ -1605,13 +1563,8 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/ApiResponse'
|
||||
- type: object
|
||||
properties:
|
||||
data:
|
||||
description: "业务响应数据"
|
||||
$ref: '#/components/schemas/AttachmentRecord'
|
||||
description: "业务响应数据"
|
||||
$ref: '#/components/schemas/AttachmentRecord'
|
||||
'400':
|
||||
description: "参数错误、缺少文件或附件保存失败"
|
||||
'401':
|
||||
@@ -1637,17 +1590,12 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/ApiResponse'
|
||||
- type: object
|
||||
properties:
|
||||
data:
|
||||
description: "业务响应数据"
|
||||
type: object
|
||||
properties:
|
||||
attachments_id:
|
||||
description: "附件业务 ID"
|
||||
type: string
|
||||
description: "业务响应数据"
|
||||
type: object
|
||||
properties:
|
||||
attachments_id:
|
||||
description: "附件业务 ID"
|
||||
type: string
|
||||
'400':
|
||||
description: "参数错误、附件已被文档引用或删除失败"
|
||||
'401':
|
||||
@@ -1681,18 +1629,13 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/ApiResponse'
|
||||
- type: object
|
||||
properties:
|
||||
data:
|
||||
description: "业务响应数据"
|
||||
type: object
|
||||
properties:
|
||||
items:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/DocumentRecord'
|
||||
description: "业务响应数据"
|
||||
type: object
|
||||
properties:
|
||||
items:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/DocumentRecord'
|
||||
'401':
|
||||
description: "token 无效或已过期"
|
||||
'403':
|
||||
@@ -1718,13 +1661,8 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/ApiResponse'
|
||||
- type: object
|
||||
properties:
|
||||
data:
|
||||
description: "业务响应数据"
|
||||
$ref: '#/components/schemas/DocumentRecord'
|
||||
description: "业务响应数据"
|
||||
$ref: '#/components/schemas/DocumentRecord'
|
||||
'400':
|
||||
description: "参数错误"
|
||||
'401':
|
||||
@@ -1757,13 +1695,8 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/ApiResponse'
|
||||
- type: object
|
||||
properties:
|
||||
data:
|
||||
description: "业务响应数据"
|
||||
$ref: '#/components/schemas/DocumentRecord'
|
||||
description: "业务响应数据"
|
||||
$ref: '#/components/schemas/DocumentRecord'
|
||||
'400':
|
||||
description: "参数错误、附件不存在或文档创建失败"
|
||||
'401':
|
||||
@@ -1796,13 +1729,8 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/ApiResponse'
|
||||
- type: object
|
||||
properties:
|
||||
data:
|
||||
description: "业务响应数据"
|
||||
$ref: '#/components/schemas/DocumentRecord'
|
||||
description: "业务响应数据"
|
||||
$ref: '#/components/schemas/DocumentRecord'
|
||||
'400':
|
||||
description: "参数错误、附件不存在或修改失败"
|
||||
'401':
|
||||
@@ -1834,17 +1762,12 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/ApiResponse'
|
||||
- type: object
|
||||
properties:
|
||||
data:
|
||||
description: "业务响应数据"
|
||||
type: object
|
||||
properties:
|
||||
document_id:
|
||||
description: "文档业务 ID"
|
||||
type: string
|
||||
description: "业务响应数据"
|
||||
type: object
|
||||
properties:
|
||||
document_id:
|
||||
description: "文档业务 ID"
|
||||
type: string
|
||||
'400':
|
||||
description: "参数错误或删除失败"
|
||||
'401':
|
||||
@@ -1876,18 +1799,13 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/ApiResponse'
|
||||
- type: object
|
||||
properties:
|
||||
data:
|
||||
description: "业务响应数据"
|
||||
type: object
|
||||
properties:
|
||||
items:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/DocumentHistoryRecord'
|
||||
description: "业务响应数据"
|
||||
type: object
|
||||
properties:
|
||||
items:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/DocumentHistoryRecord'
|
||||
'401':
|
||||
description: "token 无效或已过期"
|
||||
'403':
|
||||
@@ -1895,3 +1813,5 @@ paths:
|
||||
'415':
|
||||
description: "请求体必须为 application/json"
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user