liuxiaolong
2019-07-27 05f96119b4d2e73316f221b08554a7de543fb0d5
controllers/initForData.go
@@ -1,6 +1,7 @@
package controllers
import (
   "basic.com/dbapi.git"
   "fmt"
   "github.com/gin-gonic/gin"
   "strings"
@@ -20,7 +21,7 @@
// @Tags realTime
// @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]
// @Router /data/api-v/realTime/initForCaptureData [POST]
//实时抓拍数据初始化
func (rc *RealTimeController) InitForCaptureData(c *gin.Context) {
   searchBody := make(map[string]interface{}, 0)
@@ -37,7 +38,7 @@
      "]}},\"size\":\"20\",\"sort\":[{\"picDate\":{\"order\":\"desc\"}}]," +
      "\"_source\":[\"baseInfo\",\"alarmRules\",\"sex\",\"analyServerName\",\"sdkName\",\"ageDescription\",\"content\",\"id\",\"cameraAddr\",\"picMaxUrl\",\"picDate\",\"race\",\"videoUrl\",\"picSmUrl\",\"taskName\",\"isAlarm\",\"isAlarm\",\"analyServerIp\",\"cameraId\"]" +
      "}"
   fmt.Println(prama)
   //logger.Debug("InitForCaptureData:", prama)
   tokenRes := esutil.GetEsDataReq(url, prama, true)
   util.ResponseFormat(c, code.Success, tokenRes)
}
@@ -50,13 +51,13 @@
// @Param obj body map true "底库数据"
// @Success 200 {string} json "{"code":200, msg:"目录结构数据", success:true}"
// @Failure 500 {string} json "{"code":500,  msg:"返回错误信息", success:false}"
// @Router /data/api-v/realTime/monitoring [POST]
// @Router /data/api-v/realTime/initForMonitoringData [POST]
//实时监控数据初始化
func (rc *RealTimeController) InitForMonitoringData(c *gin.Context) {
   searchBody := make(map[string]interface{}, 0)
   c.BindJSON(&searchBody)
   index := config.EsInfo.EsIndex.VideoPersons.IndexName
   index := config.EsInfo.EsIndex.VideoPersons.IndexName +","+config.EsInfo.EsIndex.Personaction.IndexName
   cameraIdStr := ""
   cameraId := searchBody["treeNodes"].([]interface{})
   if cameraId != nil && len(cameraId) > 0 {
@@ -75,7 +76,7 @@
      "/" + index + "/_search"
   var setApi dbapi.SysSetApi
   _, sysconf := setApi.GetServerInfo()
   analyServerFilterStr := "{\"term\":{\"analyServerId\":\"" + sysconf.ServerId + "\"}},"
   analyServerFilterStr := "{\"term\":{\"analyServerId\":\"" + sysconf.ServerId + "\"}}"
   prama := "{\"query\":{\"bool\":{\"filter\":[" +
      cameraIdStr +
@@ -85,7 +86,8 @@
      "\"sort\":[{\"picDate\":{\"order\":\"desc\"}}]," +
      "\"size\":\"20\"," +
      "\"_source\":[\"baseInfo\",\"alarmRules\",\"sex\",\"analyServerName\",\"sdkName\",\"ageDescription\",\"content\",\"id\",\"cameraAddr\",\"picMaxUrl\",\"picDate\",\"race\",\"videoUrl\",\"picSmUrl\",\"taskName\",\"personIsHub\",\"isAlarm\",\"analyServerIp\",\"cameraId\"]}"
   fmt.Println(prama)
   //logger.Debug("url:", url)
   //logger.Debug("InitForMonitoringData:", prama)
   tokenRes := esutil.GetEsDataReq(url, prama, true)
   util.ResponseFormat(c, code.Success, tokenRes)
}