创建检查记录
接口地址
bash
`POST /inspection/create`
鉴权/权限
- 要求鉴权:是(JWT)
- 要求权限:INSPECTION_ADD
请求方式
POST(application/json)
参数
参数名 | 描述 | 是否必须 | 类型 |
---|---|---|---|
inspection_name | 检查名称 | 否 | string |
task_id | 任务ID | 是 | string |
executor_id | 执行人 | 否 | string |
reference_image_id | 参考图片ID | 否 | string |
progress | 检查进度 | 否 | int |
start_time | 开始时间 | 否 | string(ISO8601) |
end_time | 结束时间 | 否 | string(ISO8601) |
inspection_status | 检查状态 | 否 | string |
成功返回
JSON
{
"code": 0,
"data": {
"inspection_id": "xxx",
"inspection_name": "xxx",
"task_id": "xxx",
"progress": 0,
"...": "更多字段"
},
"msg": "检查记录创建成功"
}
获取检查记录详情
接口地址
GET /inspection/getInspectionById/<inspection_id>
鉴权/权限
- 要求鉴权:是(JWT)
- 要求权限:INSPECTION_READ
请求参数
inspection_id(URL路径)
返回示例
JSON
{
"code": 0,
"data": {
"inspection_id": "xxx",
"inspection_name": "",
"task_id": "xxx",
"executor_id": "xxx",
"executor_name": "张三",
"reference_image_id": "img-xxx",
"reference_image_name": "图片名字",
"progress": 30,
"start_time": "2024-06-20T12:35:00",
"end_time": null,
"inspection_status": "not_started",
"status_name": "未开始",
"flight_id": "flight-xxx",
"aircraft_id": "ac-xxx",
"aircraft_name": "波音787",
"created_at": "2024-06-20T11:01:00",
"updated_at": "2024-06-20T11:10:00"
},
"msg": "检查记录获取成功"
}
更新检查记录
接口地址
bash
PUT /inspection/updateInspection/<inspection_id>
鉴权/权限
- 要求鉴权:是(JWT)
- 要求权限:INSPECTION_UPDATE
请求体(JSON)参数
字段同上,全部可选。
删除检查记录
接口地址
bash
`DELETE /api/inspection/deleteInspection/<inspection_id>`
鉴权/权限
- 要求鉴权:是(JWT)
- 要求权限:INSPECTION_DELETE
成功返回
JSON
{
"code": 0,
"msg": "检查记录删除成功"
}
分页&条件查询检查记录
接口地址
GET /inspection/search
鉴权/权限
- 要求鉴权:是(JWT)
- 要求权限:INSPECTION_READ
查询参数(全部可选,分页参数必须)
参数名 | 描述 | 类型 |
---|---|---|
task_id | 任务ID | string |
executor_id | 执行人ID | string |
inspection_status | 检查状态 | string |
reference_image_id | 参考图片ID | string |
flight_id | 航班ID | string |
aircraft_id | 飞机ID | string |
executor_name | 执行人姓名 | string |
start_time_from | 开始时间起 | string(ISO8601) |
start_time_to | 开始时间止 | string(ISO8601) |
end_time_from | 结束时间起 | string(ISO8601) |
end_time_to | 结束时间止 | string(ISO8601) |
current_page(必须) | 页码 | int |
page_size(必须) | 每页个数 | int |
返回示例
JSON
{
"code": 0,
"data": {
"data": [
{
"inspection_id": "xxx",
"inspection_name": "xx",
"executor_name": "...",
"...": "..."
}
],
"pagination": {
"current_page": 1,
"page_size": 10,
"total": 53,
"total_pages": 6
}
},
"msg": "检查记录获取成功"
}
更新用户人脸信息
接口地址
bash
/auth/updateFaceInfo
传入参数
- 要求鉴权:是(JWT)
- 请求方式:POST
- 传入方式:JSON
- 要求权限:无,仅登录
参数名 | 描述 | 是否必须 | 类型 |
---|---|---|---|
faceInfo | Base64人脸图片 | 是 | string |
返回值——成功
JSON
{
"code": 0,
"data": "(faceInfo原样返回)",
"msg": null
}
返回值——缺少人脸信息
JSON
{
"code": 1,
"data": null,
"msg": "人脸信息缺失"
}
请求示例
JavaScript
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer your_jwt_token");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"faceInfo": "base64imagehere..."
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("http://localhost:5000/api/auth/updateFaceInfo", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));