iot/docs/jianguanzhihui/donghuoliren.md
2024-12-02 11:50:38 +08:00

57 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 签名算法的说明
## 约定token的值为
aB3$dEfGhiJkLmNoPqRsTuVwXyZ!@#4f5e6d7c8b9a0f1e2d
## 所有接口都必须传递签名值,签名值算法如下:
参数签名算法,算法逻辑如下:
1. 将对象转换成JSON字符串str1, str1即为post请求中的body体
2. 将str1和给定的token值进行拼接后然后对字符串进行md5加密, 拼接格式如何: md5_str = md5($token + str1 + $token)
3. md5_str放到post请求的header里面格式如下: sign: md5_str
## 推送的数据格式
```text
method: post
header:
sign: md5($token + body + $token)
content-type: application/json
body:
{
"count": 1, // 单位时间内发生的次数目前固定为1即每次发生后都推送
"taskId": "0520101121011022700001_22706", // 点位编码 + 事件编码;用于确认同一个设备发送的同一类型的事件
"eventInfo": {
"occurrenceTime": "2024-11-29 09:01:40", // 事件发送的时间
"location": "0520101121011022700001", // 产生该事件的设备的点位信息编码
"description": "person", // 事件描述
"category": "23104", // 事件分类信息, 目前系统中 (23104 动火离人 )
"attachments": [
{
"url": "https://lgsiot.njau.edu.cn/upload/2024/11/29/2024-11-29-1732842080-1732842100.mp4", // 视频文件的url地址
"name": "2024-11-29-17328420801732842100.mp4" // 视频文件的名称
}
]
}
}
```
## 推送消息返回格式
### 推送成功
```json
{"result": "ok"}
```
### 推送失败
```json
{"error": {"code": -1, "message": "错误描述信息"}}
```
## 推送机制
```text
1. 当http请求效应的状态码为非200时推送方尝试重复推送直到返回的状态码为200注意如果接收方的服务器异常可能会收到之前的消息
2. 当http请求效应的状态码为200时推送方记录日志并推送吓一条消息
```