EVA-Notify/doc/api.md

428 lines
5.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# 接口文档
## 基本格式
### 成功响应格式
```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": "2",
"place": "东三-204",
"otherDutyTime": ""
}
```
#### 当前在值班(其他值班时间)
data:
```json
{
"isInDuty": true,
"inDutyCnt": 3,
"currentDuty": "others",
"place": "蓝田",
"otherDutyTime": "9:30-11:30"
}
```
#### 当前未值班
data:
```json
{
"isInDuty": false,
"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 不能充电呢?"
}
```
### 加入 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"
},
{
"avatar": "https://....jpg",
"id": 21370,
"op": "宇航员",
"type": 2,
"content": "1",
"createdTime": "2024-03-07T19:58:27.838816"
},
{
"avatar": "https://....jpg",
"id": 21373,
"op": "宇航员",
"type": 2,
"content": "4",
"createdTime": "2024-03-07T20:28:12.070707"
},
{
"avatar": "https://....jpg",
"id": 21374,
"op": "宇航员",
"type": 2,
"content": "5",
"createdTime": "2024-03-07T20:30:15.770486"
}
],
"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": "下周一"
}
```