You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
190 lines
3.0 KiB
Markdown
190 lines
3.0 KiB
Markdown
# 前端管理端接口契约
|
|
|
|
本轮不改前端。
|
|
这份文档用于后续管理端接口适配。
|
|
|
|
## 响应包装
|
|
|
|
管理端 API 默认 HTTP 200。
|
|
|
|
成功:
|
|
|
|
```json
|
|
{"data": {}, "code": 200, "message": "成功"}
|
|
```
|
|
|
|
失败:
|
|
|
|
```json
|
|
{"data": null, "code": 403, "message": "权限不足"}
|
|
```
|
|
|
|
字段输出使用 camelCase。
|
|
|
|
## 认证
|
|
|
|
登录:
|
|
|
|
```http
|
|
POST /auth/loginByPassword
|
|
POST /auth/loginByCode
|
|
POST /auth/register
|
|
POST /auth/refresh
|
|
POST /auth/logout
|
|
GET /auth/codes
|
|
```
|
|
|
|
登录响应核心字段:
|
|
|
|
```json
|
|
{
|
|
"accessToken": "...",
|
|
"tokenType": "Bearer",
|
|
"expiresIn": 86400,
|
|
"refreshToken": "...",
|
|
"refreshExpiresIn": 2592000,
|
|
"user": {}
|
|
}
|
|
```
|
|
|
|
后续请求:
|
|
|
|
```http
|
|
Authorization: Bearer <accessToken>
|
|
```
|
|
|
|
## 系统接口
|
|
|
|
用户:
|
|
|
|
```http
|
|
GET /sys/user/current
|
|
GET /sys/user/list
|
|
GET /sys/user/page
|
|
POST /sys/user
|
|
PUT /sys/user/{id}
|
|
DELETE /sys/user/{id}
|
|
PUT /sys/user/password
|
|
```
|
|
|
|
角色:
|
|
|
|
```http
|
|
GET /sys/role/list
|
|
GET /sys/role/page
|
|
POST /sys/role
|
|
PUT /sys/role/{id}
|
|
DELETE /sys/role/{id}
|
|
```
|
|
|
|
菜单:
|
|
|
|
```http
|
|
GET /sys/menu/list
|
|
GET /sys/menu/tree
|
|
GET /sys/menu/exists
|
|
POST /sys/menu
|
|
PUT /sys/menu/{id}
|
|
DELETE /sys/menu/{id}
|
|
```
|
|
|
|
部门:
|
|
|
|
```http
|
|
GET /sys/dept/list
|
|
GET /sys/dept/page
|
|
GET /sys/dept/tree
|
|
POST /sys/dept
|
|
PUT /sys/dept/{id}
|
|
DELETE /sys/dept/{id}
|
|
```
|
|
|
|
配置:
|
|
|
|
```http
|
|
GET /sys/config/list
|
|
GET /sys/config/page
|
|
POST /sys/config
|
|
PUT /sys/config/{id}
|
|
DELETE /sys/config/{id}
|
|
```
|
|
|
|
字典:
|
|
|
|
```http
|
|
GET /sys/dict/type/page
|
|
GET /sys/dict/type
|
|
POST /sys/dict/type
|
|
PUT /sys/dict/type/{id}
|
|
DELETE /sys/dict/type/{id}
|
|
GET /sys/dict/data/page
|
|
GET /sys/dict/data/list
|
|
GET /sys/dict/data/{id}
|
|
GET /sys/dict/data
|
|
POST /sys/dict/data
|
|
PUT /sys/dict/data/{id}
|
|
DELETE /sys/dict/data/{id}
|
|
DELETE /sys/dict/data/batch
|
|
```
|
|
|
|
日志:
|
|
|
|
```http
|
|
GET /sys/log/page
|
|
DELETE /sys/log/{id}
|
|
DELETE /sys/log/batch
|
|
```
|
|
|
|
文件:
|
|
|
|
```http
|
|
POST /upload
|
|
POST /upload/chunk/init
|
|
POST /upload/chunk/upload
|
|
POST /upload/chunk/merge
|
|
DELETE /upload/chunk/{uploadId}
|
|
GET /upload/chunk/{uploadId}/progress
|
|
POST /upload/chunk/cleanup
|
|
GET /sys/file/{fileId}
|
|
DELETE /sys/file/{fileId}
|
|
POST /sys/file/{fileId}/restore
|
|
DELETE /sys/file/{fileId}/permanent
|
|
POST /sys/file/{fileId}/share
|
|
DELETE /sys/file/{fileId}/share
|
|
GET /file/{fileId}/download
|
|
GET /file/{fileId}/preview
|
|
GET /file/{fileId}/thumbnail
|
|
GET /file/share/{shareCode}
|
|
GET /file/share/{shareCode}/download
|
|
```
|
|
|
|
用户扩展属性:
|
|
|
|
```http
|
|
GET /sys/user-attributes/current
|
|
PUT /sys/user-attributes/current
|
|
GET /sys/user-attributes/{userId}
|
|
PUT /sys/user-attributes/{userId}
|
|
GET /sys/user-attributes/{userId}/{group}/{key}
|
|
PUT /sys/user-attributes/{userId}/{group}/{key}
|
|
DELETE /sys/user-attributes/{userId}/{group}
|
|
DELETE /sys/user-attributes/{userId}/{group}/{key}
|
|
POST /sys/user-attributes/{userId}/batch
|
|
```
|
|
|
|
## 分页
|
|
|
|
分页响应:
|
|
|
|
```json
|
|
{
|
|
"items": [],
|
|
"page": {
|
|
"page": 1,
|
|
"size": 10,
|
|
"pages": 1,
|
|
"total": 0
|
|
}
|
|
}
|
|
```
|