516 lines
7.5 KiB
Markdown
516 lines
7.5 KiB
Markdown
# 接口文档
|
||
|
||
## 基本格式
|
||
|
||
### 成功响应格式
|
||
|
||
```json
|
||
{
|
||
"success": true,
|
||
"data": {
|
||
"foo": "bar"
|
||
}
|
||
}
|
||
```
|
||
|
||
**NOTE:** 若无特殊说明,`POST`请求的响应`data`字段为空(`{}`),可以不用管。
|
||
|
||
### 失败响应格式
|
||
|
||
```json
|
||
{
|
||
"success": false,
|
||
"err": "some error"
|
||
}
|
||
```
|
||
|
||
### `GET`请求默认格式(若无特殊说明)
|
||
|
||
```json
|
||
{
|
||
"token": "token_test"
|
||
}
|
||
```
|
||
|
||
## 主页面
|
||
|
||
### 值班信息 `GET /duty/info`
|
||
|
||
#### 当前在值班(正常值班时间)
|
||
|
||
data:
|
||
|
||
```json
|
||
{
|
||
"isInDuty": true,
|
||
"inDutyCnt": 3,
|
||
"currentDuty": "1",
|
||
"place": "", // 只有当 currentDuty 为 others 时,place 和 值班时间 才不为空
|
||
"otherDutyStart": "",
|
||
"otherDutyEnd": "",
|
||
"offDutyReason": "",
|
||
"dutyRecoverTime": ""
|
||
}
|
||
```
|
||
|
||
#### 当前在值班(其他值班时间)
|
||
|
||
data:
|
||
|
||
```json
|
||
{
|
||
"isInDuty": true,
|
||
"inDutyCnt": 3,
|
||
"currentDuty": "others",
|
||
"place": "蓝田", // 只有当 currentDuty 为 others 时,place 才不为空
|
||
"otherDutyStart": "2024-03-07T11:52:48.523303", // Timestamp
|
||
"otherDutyEnd": "2024-03-07T13:52:48.523303",
|
||
"offDutyReason": "",
|
||
"dutyRecoverTime": ""
|
||
}
|
||
```
|
||
|
||
#### 当前未值班
|
||
|
||
data:
|
||
|
||
```json
|
||
{
|
||
"isInDuty": false,
|
||
"inDutyCnt": 0,
|
||
"currentDuty": "0", // '0' 代表正常值班时间下班,'others' 代表其他值班时间下班
|
||
"place": "",
|
||
"otherDutyStart": "",
|
||
"otherDutyEnd": "",
|
||
"offDutyReason": "学园维修",
|
||
"dutyRecoverTime": "下周一"
|
||
}
|
||
```
|
||
|
||
#### 当前值班暂停
|
||
|
||
data:
|
||
|
||
```json
|
||
{
|
||
"isInDuty": false,
|
||
"inDutyCnt": 0,
|
||
"currentDuty": "off", // 'off' 代表当前值班暂停
|
||
"place": "",
|
||
"otherDutyStart": "",
|
||
"otherDutyEnd": "",
|
||
"offDutyReason": "考试周",
|
||
"dutyRecoverTime": "下周一"
|
||
}
|
||
```
|
||
|
||
## 账号登陆
|
||
|
||
### 微信小程序登陆 `POST /login` OK
|
||
|
||
- Request
|
||
|
||
```json
|
||
{
|
||
"code": "wechat_login_code"
|
||
}
|
||
```
|
||
|
||
- Response
|
||
|
||
```json
|
||
{
|
||
"success": true,
|
||
"token": "your_token"
|
||
}
|
||
```
|
||
|
||
### 检查 token 是否登陆 `GET /checklogin?token={token}` OK
|
||
|
||
```json
|
||
{
|
||
"islogin": true
|
||
}
|
||
```
|
||
|
||
- Response
|
||
|
||
```json
|
||
{
|
||
"success": true,
|
||
"token": "your_token"
|
||
}
|
||
```
|
||
|
||
## 用户页面
|
||
|
||
### 个人信息 `GET /user/info`
|
||
|
||
data:
|
||
|
||
```json
|
||
{
|
||
"name": "马保国",
|
||
"phone": "13333333333"
|
||
}
|
||
```
|
||
|
||
### 修改个人信息 `POST /user/update`
|
||
|
||
Request body:
|
||
|
||
```json
|
||
{
|
||
"name": "宇航员",
|
||
"phone": "1233333210"
|
||
}
|
||
```
|
||
|
||
### 本地化设置
|
||
|
||
#### 获取本地化设置 `GET /user/locale/get`
|
||
|
||
data:
|
||
|
||
```json
|
||
{
|
||
"lang": "zh_CN"
|
||
}
|
||
```
|
||
|
||
#### 更新本地化设置 `POST /user/locale/update`
|
||
|
||
Request body:
|
||
|
||
```json
|
||
{
|
||
"lang": "en_US"
|
||
}
|
||
```
|
||
|
||
### 意见反馈 `POST /report`
|
||
|
||
Request body:
|
||
|
||
```json
|
||
{
|
||
"token": "token_test",
|
||
"content": "aaa bbbb ccccc"
|
||
}
|
||
```
|
||
|
||
### 我的工单(查询)`GET /user/mytickets`
|
||
|
||
data (same as oreo):
|
||
|
||
```json
|
||
{
|
||
"list": [
|
||
{
|
||
"id": 6830,
|
||
"type": 1,
|
||
"status": 5,
|
||
"device": "主机",
|
||
"deviceModel": "技嘉",
|
||
"owner": "武技栏",
|
||
"phone": "18888888888",
|
||
"createdTime": "2024-03-06T19:49:27.043865",
|
||
"isConfirmed": false
|
||
}
|
||
]
|
||
}
|
||
```
|
||
|
||
## 工单详情
|
||
|
||
### 创建工单 `POST /tickets/create`
|
||
|
||
Request
|
||
|
||
```json
|
||
{
|
||
"token": "token_test",
|
||
"type": 1, // 电器是0,电脑是1(bushi)
|
||
"device": "华硕",
|
||
"deviceModel": "天选3",
|
||
"owner": "西西弗",
|
||
"phone": "12333333333",
|
||
"description": "没法用pd充电",
|
||
"accessories": [0]
|
||
}
|
||
```
|
||
|
||
### 添加评论 `POST /tickets/addnote`
|
||
|
||
Request
|
||
|
||
```json
|
||
{
|
||
"token": "token_test",
|
||
"id": "id",
|
||
"content": "为什么 PD 不能充电呢?",
|
||
}
|
||
```
|
||
|
||
Data
|
||
|
||
```json
|
||
{
|
||
"id": "id", // 返回的是评论的 id
|
||
}
|
||
```
|
||
|
||
### 加入 Oreo `POST /tickets/addtooreo`
|
||
|
||
Request
|
||
|
||
```json
|
||
{
|
||
"token": "token_test",
|
||
"id": 4234
|
||
}
|
||
```
|
||
|
||
### 认领工单 `POST /tickets/pick`
|
||
|
||
Request
|
||
|
||
```json
|
||
{
|
||
"token": "token_test",
|
||
"id": 4234
|
||
}
|
||
```
|
||
|
||
### 更新工单状态 `POST /tickets/update`
|
||
|
||
Request
|
||
|
||
```json
|
||
{
|
||
"token": "token_test",
|
||
"id": "id",
|
||
"status": 3
|
||
}
|
||
```
|
||
|
||
### 确认已取回 `POST /tickets/retrieve`
|
||
|
||
Request
|
||
|
||
```json
|
||
{
|
||
"token": "token_test",
|
||
"id": "id"
|
||
}
|
||
```
|
||
|
||
### 获取七天内未完成工单 `GET /tickets/uncompleted`
|
||
|
||
Request
|
||
|
||
```json
|
||
{
|
||
"token": "token_test",
|
||
"pageId": 1,
|
||
"count": 10,
|
||
"queryType": 0
|
||
}
|
||
```
|
||
|
||
### 获取所有预填写工单 `GET /tickets/list`
|
||
|
||
Request
|
||
|
||
```json
|
||
{
|
||
"token": "token_test",
|
||
"pageId": 1,
|
||
"count": 10,
|
||
"queryType": 0
|
||
}
|
||
```
|
||
|
||
### 查询预填写工单 `GET /tickets/search`
|
||
|
||
Request
|
||
|
||
```json
|
||
{
|
||
"token": "token_test",
|
||
"values": "test",
|
||
"pageId": 1,
|
||
"count": 10,
|
||
"queryType": 0
|
||
}
|
||
```
|
||
|
||
### 工单信息 `GET /tickets/info?id={id}`
|
||
|
||
data (same as oreo):
|
||
|
||
```json
|
||
{
|
||
"id": 6847,
|
||
"type": 1,
|
||
"device": "华硕",
|
||
"deviceModel": "灵耀X14",
|
||
"owner": "唐姐姐",
|
||
"phone": "15555555555",
|
||
"description": "清灰",
|
||
"workers": [],
|
||
"createdTime": "2024-03-07T19:52:48.523303",
|
||
"status": 5,
|
||
"isConfirmed": false,
|
||
"notes": [
|
||
{
|
||
"avatar": "https://....jpg",
|
||
"id": 21368,
|
||
"op": "宇航员",
|
||
"type": 0,
|
||
"content": "",
|
||
"createdTime": "2024-03-07T19:52:48.523305",
|
||
"pic": [], // 只有当 type = 1 (评论) 时 pic 才有可能非空
|
||
},
|
||
{
|
||
"avatar": "https://....jpg",
|
||
"id": 21370,
|
||
"op": "宇航员",
|
||
"type": 2,
|
||
"content": "1",
|
||
"createdTime": "2024-03-07T19:58:27.838816",
|
||
"pic": [], // 只有当 type = 1 (评论) 时 pic 才有可能非空
|
||
},
|
||
{
|
||
"avatar": "https://....jpg",
|
||
"id": 21373,
|
||
"op": "宇航员",
|
||
"type": 2,
|
||
"content": "4",
|
||
"createdTime": "2024-03-07T20:28:12.070707",
|
||
"pic": [], // 只有当 type = 1 (评论) 时 pic 才有可能非空
|
||
},
|
||
{
|
||
"avatar": "https://....jpg",
|
||
"id": 21374,
|
||
"op": "宇航员",
|
||
"type": 2,
|
||
"content": "5",
|
||
"createdTime": "2024-03-07T20:30:15.770486",
|
||
"pic": [], // 只有当 type = 1 (评论) 时 pic 才有可能非空
|
||
},
|
||
{
|
||
"avatar": "https://....jpg",
|
||
"id": 21374,
|
||
"op": "宇航员",
|
||
"type": 1,
|
||
"content": "清灰换硅脂",
|
||
"createdTime": "2024-03-07T20:30:15.780486",
|
||
"pic": [
|
||
"https://....jpg",
|
||
...
|
||
]
|
||
}
|
||
],
|
||
"accessories": [2],
|
||
"picked": false
|
||
}
|
||
```
|
||
|
||
## 成员相关
|
||
|
||
### 成员登录 `POST /member/login`
|
||
|
||
Request
|
||
|
||
```json
|
||
{
|
||
"token": "token_test",
|
||
"code": "code_test",
|
||
}
|
||
```
|
||
这里的 code 是来源于小程序扫描统一身份认证生成的二维码
|
||
|
||
### 检查 token 是否登陆 `GET /member/checklogin?token={token}` OK
|
||
|
||
data
|
||
|
||
```json
|
||
{
|
||
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png",
|
||
"name": "宇航员",
|
||
"phone": "13311451419",
|
||
}
|
||
```
|
||
|
||
### 成员登出 `POST /member/logout`
|
||
|
||
Request
|
||
|
||
```json
|
||
{
|
||
"token": "token_test"
|
||
}
|
||
```
|
||
|
||
### 成员值班信息 `GET /member/duty/info`
|
||
|
||
#### 当前在值班
|
||
|
||
data:
|
||
|
||
```json
|
||
{
|
||
"isInDuty": true,
|
||
"inDutyCnt": 3,
|
||
"currentDuty": "2"
|
||
}
|
||
```
|
||
|
||
#### 当前未值班
|
||
|
||
data:
|
||
|
||
```json
|
||
{
|
||
"isInDuty": false,
|
||
"offDutyReason": "学园维修",
|
||
"dutyRecoverTime": "下周一"
|
||
}
|
||
```
|
||
|
||
### 成员请假 `POST /member/askleave`
|
||
|
||
Request
|
||
|
||
```json
|
||
{
|
||
"token": "token_test",
|
||
"week": "1",
|
||
"shift": "2",
|
||
"reason": "家庭原因",
|
||
"substitute": "晓洋" // 未找人代班则为空
|
||
}
|
||
```
|
||
|
||
### 值班总结上传 `POST /member/conclusion`
|
||
|
||
Request
|
||
|
||
```json
|
||
{
|
||
"token": "token_test",
|
||
"conclusion": "周四第三班,一人请假,共收两台电脑,均劝退已取回。由上一班交接两台电脑,其中一台维修成功已取回,一台仍在维修。"
|
||
}
|
||
```
|
||
|
||
### 修改值班人数 `POST /member/dutycnt`
|
||
|
||
Request
|
||
|
||
```json
|
||
{
|
||
"token": "token_test",
|
||
"dutycnt": 5,
|
||
}
|
||
``` |