1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
| package controllers
|
| import (
| "fmt"
|
| "github.com/gin-gonic/gin"
| "webserver/extend/code"
| "webserver/extend/config"
| "webserver/extend/esutil"
| "webserver/extend/util"
| )
|
| type AndroidAction struct {
| }
|
| // @Summary Android实时获取数据
| // @Description 实时获取数据
| // @Accept json
| // @Produce json
| // @Tags es
| // @Success 200 {string} json "{"code":200, msg:"目录结构数据", success:true}"
| // @Failure 500 {string} json "{"code":500, msg:"返回错误信息", success:false}"
| // @Router /data/api-v/realTime/action [POST]
| //实时抓拍
| func (rc *RealTimeController) PostAction(c *gin.Context) {
| searchBody := make(map[string]interface{}, 0)
| c.BindJSON(&searchBody)
| sec := searchBody["sec"].(string)
| index := config.EsInfo.EsIndex.VideoPersons.IndexName + "," + config.EsInfo.EsIndex.Personaction.IndexName
| url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport +
| "/" + index + "/_search"
| prama := "{\"query\":{\"bool\":{\"filter\":[{\"term\":{\"personIsHub\":\"1\"}},{\"range\":{\"picDate\":{\"gte\":\"now+8h-" + sec + "s\",\"lt\":\"now+8h\"}}}]}},\"size\":\"1000\",\"sort\":[{\"picDate\":{\"order\":\"desc\"}}]," +
| "\"_source\":[\"baseInfo\",\"gender\",\"indeviceName\",\"sdkType\",\"ageDescription\",\"content\",\"ID\",\"picAddress\",\"picMaxUrl\",\"picDate\",\"race\",\"videoNum\",\"picSmUrl\",\"taskName\",\"personIsHub\",\"IDCard\",\"videoIp\",\"videoReqNum\"]" +
| "}"
| fmt.Println(prama)
| tokenRes := esutil.GetEsDataReq(url, prama, true)
| util.ResponseFormat(c, code.Success, tokenRes)
| }
|
|