@heavysheep
        
        2019-03-08T09:03:48.000000Z
        字数 1984
        阅读 784
    未分类
地址 
api:[get/post] http://localhost:11000/api 
ws: ws://localhost:11000/ws
说明 
1. 除websocket外,所有接口传输均使用json格式 
2. 返回值采用龙井的模式,code=0视为成功
| 参数 | 类型 | 是否必填 | 默认值 | 说明 | 
|---|---|---|---|---|
| method | string | 是 | hello | 方法名 | 
示例
{"method":"hello"}
返回
{"data": "Hello World","code": 0,"message": ""}
请求参数
| 参数 | 类型 | 是否必填 | 默认值 | 说明 | 
|---|---|---|---|---|
| method | string | 是 | get_last_face | 方法名 | 
| limit | int | 否 | 5 | 人脸数量 | 
| process | int | 否 | 1 | 是否进行后处理,1: 是,0: 否 | 
返回参数
| 参数 | 类型 | 说明 | 
|---|---|---|
| user_number | string | 方法名 | 
| age | int/string | 如process=0, 则返回年龄,否则返回年代 | 
| gender | string | 如process=0, 则返回male/famale,否则返回男/女 | 
| last_matched | int | 最后匹配/注册时间戳 | 
| url | int | 最后匹配/注册的头像相对url | 
接口示例
{"method":"get_last_face", "limit": 2, "process": 1}
返回示例
{"code": 0,"data": {"content": [{"user_number": "000001","age": 26,"gender": "male","last_matched": 1551999724,"url": "/static/face_image/000001.jpg"},{"user_number": "000002","age": 27,"gender": "male","last_matched": 1551999410,"url": "/static/face_image/000002.jpg"}]},"message": ""}
说明 
[start_time:end_time] 左右均是开区间
请求参数
| 参数 | 类型 | 是否必填 | 默认值 | 说明 | 
|---|---|---|---|---|
| merchant_number | string | 是 | heatmap_location | 商户号 | 
| start_time | int | 是 | 起始时间 | |
| end_time | int | 是 | 结束时间 | 
返回参数
| 参数 | 类型 | 说明 | 
|---|---|---|
| x | float | 点在x轴的比例 | 
| y | float | 点在y轴的比例 | 
接口示例
{"method":"heatmap_location", "start_time": 1552028140, "end_time": 1552028427}
返回示例
{"code": 0,"data": {"content": [{"x": 0.36,"y": 0.49},{"x": 0.36,"y": 0.49},{"x": 0.36,"y": 0.49},{"x": 0.36,"y": 0.49},{"x": 0.28,"y": 0.46}]},"message": ""}
说明 
[start_time:end_time] 左右均是开区间 
[first_time: now_time + time_range) 区间时间切分左开右闭 
如time_range 不可被 end_time - start_time整除,则得到的最后一个单位截止时间是end_time
请求参数
| 参数 | 类型 | 是否必填 | 默认值 | 说明 | 
|---|---|---|---|---|
| merchant_number | string | 是 | heatmap_location | 商户号 | 
| start_time | int | 是 | 起始时间 | |
| end_time | int | 是 | 结束时间 | |
| time_range | int | 是 | 切分时间 | 
返回参数
| 参数 | 类型 | 说明 | 
|---|---|---|
| user_number | string | 方法名 | 
| timestamp | int | 起始时间 | 
| person_num | int | 从起始时间开始,切分时间内的人数 | 
接口示例
{"method":"person_num", "start_time": 1552028140, "end_time": 1552028427, "time_range": 60}
返回示例
{"code": 0,"data": {"content": [{"timestamp": 1552028140,"person_num": 2},{"timestamp": 1552028200,"person_num": 1},{"timestamp": 1552028260,"person_num": 0},{"timestamp": 1552028320,"person_num": 0},{"timestamp": 1552028380,"person_num": 2}]},"message": ""}
请求参数 
任意真值
返回参数 
base64/jpg 格式图片
备注 
是否使用其他推流方式可以再议