sunty
2019-07-26 32fb3e694126afd073965263583c20d0ac62ab67
controllers/dbtablesCon.go
@@ -29,15 +29,17 @@
   url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport +
      "/" + config.EsInfo.EsIndex.DbTables.IndexName + "/_search"
   isSync := c.Params.ByName("isSync")
   syncTerm := ""
   var setApi dbapi.SysSetApi
   _, sysconf := setApi.GetServerInfo()
   analyServerFilterStr := ""
   if isSync == "1" {
      syncTerm = ",{\"term\":{\"isSync\":\"1\"}}" // 同步库
      analyServerFilterStr = "{\"term\":{\"analyServerId\":\"" + sysconf.ServerId + "\"}}" // 同步库
   } else if isSync == "2" {
      syncTerm = ",{\"term\":{\"isSync\":\"2\"}}" // / 本地库
      analyServerFilterStr = "{\"term\":{\"analyServerId\":\"\"}}" // / 本地库
   }
   params := "{\"query\":{\"bool\":{\"must\":[" +
      "{\"term\":{\"isDelete\":\"0\"}}" + syncTerm + "]}}," +
      "\"from\":0,\"size\":100,\"sort\":{\"id\":{\"order\":\"asc\"}}}"
      "{\"term\":{\"isDelete\":\"0\"}}" + analyServerFilterStr + "]}}," +
      "\"from\":0,\"size\":1000,\"sort\":{\"id\":{\"order\":\"asc\"}}}"
   logger.Debug("请求url:%s;\n 请求参数params:%s", url, params)
   data := esutil.GetEsDataReq(url, params, true)
@@ -107,6 +109,14 @@
   c.BindJSON(&dbtable)
   tableId := uuid.NewV4().String()
   dbtable.Id = tableId
   if dbtable.analyServerId == "sync" {
      var setApi dbapi.SysSetApi
      _, sysconf := setApi.GetServerInfo()
      dbtable.analyServerId = sysconf.ServerId
   }
   if dbtable.analyServerId == "local" {
      dbtable.analyServerId = ""
   }
   url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport +
      "/" + config.EsInfo.EsIndex.DbTables.IndexName + "/" + config.EsInfo.EsIndex.DbTables.IndexType + "/" + tableId + "?refresh=wait_for"
   dbtable.PriInsert() // 添加时间和创建人