add mock
parent
be4bc9649d
commit
2d9aec3229
|
|
@ -0,0 +1,242 @@
|
|||
# 接口文档
|
||||
|
||||
## 基本格式
|
||||
|
||||
### 成功响应格式
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"foo": "bar"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**NOTE:** 若无特殊说明,`POST`请求的响应`data`字段为空(`{}`),可以不用管。
|
||||
|
||||
### 失败响应格式
|
||||
|
||||
```json
|
||||
{
|
||||
"success": false,
|
||||
"err": "some error"
|
||||
}
|
||||
```
|
||||
|
||||
### `GET`请求默认格式(若无特殊说明)
|
||||
|
||||
```json
|
||||
{
|
||||
"token": "token_test"
|
||||
}
|
||||
```
|
||||
|
||||
## 主页面
|
||||
|
||||
### 统计数据 `GET /admin/stats`
|
||||
|
||||
data:
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"notInOreo": 114,
|
||||
"total": 514
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 当前值班信息 `GET /admin/duty/current`
|
||||
|
||||
data:
|
||||
|
||||
```json
|
||||
{
|
||||
"isInDuty": true,
|
||||
"currentDuty": "2",
|
||||
"inDutyCnt": 3,
|
||||
"otherDutyTime": "",
|
||||
"offDutyReason": "",
|
||||
"place": "204",
|
||||
"dutyRecoverTime": ""
|
||||
}
|
||||
```
|
||||
|
||||
## 主席团页面
|
||||
|
||||
### 值班表管理
|
||||
|
||||
#### 更新值班表 `POST /admin/sheet/create`
|
||||
|
||||
request:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "2024 春学期值班表",
|
||||
"sheet": [
|
||||
{
|
||||
"weekday": 1,
|
||||
"shift": 1,
|
||||
"workers": ["马嘉祺", "丁程鑫", "宋亚轩"],
|
||||
"leader": "蔡徐坤"
|
||||
},
|
||||
{
|
||||
"weekday": 1,
|
||||
"shift": 2,
|
||||
"workers": ["王俊凯", "易烊千玺", "王源"],
|
||||
"leader": "丁真珍珠"
|
||||
}
|
||||
// ...
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### 更新值班表 `POST /admin/sheet/update`
|
||||
|
||||
request:
|
||||
|
||||
```json
|
||||
{
|
||||
"id": 114514,
|
||||
"name": "2024 春学期值班表",
|
||||
"sheet": [
|
||||
{
|
||||
"weekday": 1,
|
||||
"shift": 1,
|
||||
"workers": ["马嘉祺", "丁程鑫", "宋亚轩"],
|
||||
"leader": "蔡徐坤"
|
||||
},
|
||||
{
|
||||
"weekday": 1,
|
||||
"shift": 2,
|
||||
"workers": ["王俊凯", "易烊千玺", "王源"],
|
||||
"leader": "丁真珍珠"
|
||||
}
|
||||
// ...
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
#### 获取当前值班表 `GET /admin/sheet/current`
|
||||
|
||||
data:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "2024 春学期值班表",
|
||||
"id": 114514,
|
||||
"createdTime": "2024-03-07T19:52:48.523303",
|
||||
"sheet": [
|
||||
{
|
||||
"weekday": 1,
|
||||
"shift": 1,
|
||||
"workers": ["马嘉祺", "丁程鑫", "宋亚轩"],
|
||||
"leader": "蔡徐坤"
|
||||
},
|
||||
{
|
||||
"weekday": 1,
|
||||
"shift": 2,
|
||||
"workers": ["王俊凯", "易烊千玺", "王源"],
|
||||
"leader": "丁真珍珠"
|
||||
}
|
||||
// ...
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
#### 获取所有值班表 `GET /admin/sheet/list`
|
||||
|
||||
data:
|
||||
|
||||
```json
|
||||
{
|
||||
"current": 114514,
|
||||
"list": [
|
||||
{
|
||||
"name": "2024 春学期值班表",
|
||||
"id": 114514,
|
||||
"createdTime": "2024-03-07T19:52:48.523303",
|
||||
"sheet": [
|
||||
{
|
||||
"weekday": 1,
|
||||
"shift": 1,
|
||||
"workers": ["马嘉祺", "丁程鑫", "宋亚轩"],
|
||||
"leader": "蔡徐坤"
|
||||
},
|
||||
{
|
||||
"weekday": 1,
|
||||
"shift": 2,
|
||||
"workers": ["王俊凯", "易烊千玺", "王源"],
|
||||
"leader": "丁真珍珠"
|
||||
}
|
||||
// ...
|
||||
]
|
||||
}
|
||||
// ...
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### 特殊值班
|
||||
|
||||
#### 获取当前值班情况 `GET /admin/duty/current`
|
||||
|
||||
data:
|
||||
|
||||
```json
|
||||
{
|
||||
"isInDuty": true,
|
||||
"currentDuty": "2",
|
||||
"inDutyCnt": 3,
|
||||
"otherDutyTime": "",
|
||||
"offDutyReason": "",
|
||||
"place": "",
|
||||
"dutyRecoverTime": "",
|
||||
},
|
||||
```
|
||||
|
||||
#### 更新当前值班情况 `POST /admin/duty/update`
|
||||
|
||||
无关项返回空字符串,后端手动校验
|
||||
|
||||
request:
|
||||
|
||||
```json
|
||||
{
|
||||
"isInDuty": true,
|
||||
"currentDuty": "2",
|
||||
"inDutyCnt": 3,
|
||||
"otherDutyTime": "",
|
||||
"offDutyReason": "",
|
||||
"place": "204",
|
||||
"dutyRecoverTime": "",
|
||||
},
|
||||
```
|
||||
|
||||
## 日志页面
|
||||
|
||||
### 获取日志列表 `GET /admin/loglist`
|
||||
|
||||
data:
|
||||
|
||||
```json
|
||||
{
|
||||
"op": "宇航员",
|
||||
"time": "2024-03-07T19:52:48.523303",
|
||||
"operation": 2,
|
||||
"target": 1,
|
||||
"prev": {
|
||||
"id": 114,
|
||||
"info": "马嘉祺"
|
||||
},
|
||||
"curr": {
|
||||
"id": 514,
|
||||
"info": "何君琳"
|
||||
}
|
||||
},
|
||||
```
|
||||
|
||||
前端显示的信息:"{op} 于 {time} {operation} 了 {target}:{prev.info} -> {curr.info}"
|
||||
|
|
@ -1,4 +1,60 @@
|
|||
module.exports = {
|
||||
'GET /admin/stats': {
|
||||
success: true,
|
||||
data: {
|
||||
notInOreo: 114,
|
||||
total: 514,
|
||||
},
|
||||
},
|
||||
'POST /admin/sheet/update': {
|
||||
success: true,
|
||||
data: {},
|
||||
},
|
||||
'POST /admin/sheet/create': {
|
||||
success: true,
|
||||
data: {},
|
||||
},
|
||||
'GET /admin/sheet/current': {
|
||||
success: true,
|
||||
data: sheet,
|
||||
},
|
||||
'GET /admin/sheet/list': {
|
||||
success: true,
|
||||
data: sheetlist,
|
||||
},
|
||||
'GET /admin/duty/current': {
|
||||
success: true,
|
||||
data: {
|
||||
isInDuty: true,
|
||||
currentDuty: '2',
|
||||
inDutyCnt: 3,
|
||||
otherDutyTime: '',
|
||||
offDutyReason: '',
|
||||
place: '204',
|
||||
dutyRecoverTime: '',
|
||||
},
|
||||
},
|
||||
'POST /admin/duty/update': {
|
||||
success: true,
|
||||
data: {},
|
||||
},
|
||||
'GET /admin/loglist': {
|
||||
success: true,
|
||||
data: {
|
||||
op: '宇航员',
|
||||
time: '2024-03-07T19:52:48.523303',
|
||||
operation: 2,
|
||||
target: 1,
|
||||
prev: {
|
||||
id: 114,
|
||||
info: '马嘉祺',
|
||||
},
|
||||
curr: {
|
||||
id: 514,
|
||||
info: '何君琳',
|
||||
},
|
||||
},
|
||||
},
|
||||
'GET /api/currentUser': {
|
||||
data: {
|
||||
name: 'Serati Ma',
|
||||
|
|
|
|||
Loading…
Reference in New Issue