forked from kongfp/TP_Admin
31
0
Fork 1

添加筛选条件,添加接口说明文档

pull/2/head
lishuang 2 years ago
parent fee42661c5
commit ad4870e45f

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

@ -0,0 +1,112 @@
# TP后台接口文档
## 查询单个
- 请求方式GET
- 请求链接http://127.0.0.1:8002/api/
- 请求参数:
```json
{"record_time": "", "police_id": "",“event_type”: “”}
```
- 可选参数:
```json
{“page”: “1”, “page_size”: “20”}
```
- 结果示例:
![](.images/查询单个.png)
## 查询所有
- 请求方式GET
- 请求链接http://127.0.0.1:8002/api/
- 可选参数:
```json
{“page”: “1”, “page_size”: “20”}
```
- 结果示例:![](.images/查询所有.png)
## 新增数据
- 请求方式POST
- 请求链接http://127.0.0.1:8002/api/
- 请求body
```json
{
"video_hash": "vbhdrbvcw",
"record_time": "2023-05-26T13:09:05",
"police_id": "00000002",
"event_type": 1,
"is_violation": true,
"small_image": "nvikefrooiwer",
"relative_time": 4,
"video_dir": "/d/test",
"car_number": "苏a045689",
"ai_analysis": "cbwuipckwef",
"add_time": "2023-05-26T13:09:03",
"update_time": "2023-05-26T13:09:01",
"is_display": true
}
```
- 结果示例:
![](.images/新增数据.png)
## 修改数据
- 请求方式put
- 请求链接http://127.0.0.1:8002/api/20/
- 请求body
```json
{
"video_hash": "vbhdrbvcw",
"record_time": "2023-05-26T13:09:05",
"police_id": "00000002",
"event_type": 1,
"is_violation": true,
"small_image": "nvikefrooiwer",
"relative_time": 4,
"video_dir": "/d/test",
"car_number": "苏a045689",
"ai_analysis": "cbwuipckwef",
"add_time": "2023-05-26T13:09:03",
"update_time": "2023-05-26T13:09:01",
"is_display": true
}
```
- 备注操作会修改uid为20的数据
- 结果示例:
![](.images/修改数据.png)
## 删除数据
- 请求方式delete
- 请求链接http://127.0.0.1:8002/api/20/
- 备注操作会删除uid为20的数据
- 结果示例:
![](.images/删除数据.png)

@ -18,4 +18,4 @@ class ModelQuery(viewsets.ModelViewSet):
# 条件筛选
filter_backends = [DjangoFilterBackend]
filterset_fields = ('police_id',)
filterset_fields = ("record_time", "police_id", "event_type",)

Binary file not shown.
Loading…
Cancel
Save