liuxiaolong
2019-07-26 06a5b7be21e8c05bf3695754fe6f4714a7fccd68
controllers/dbtablesCon.go
@@ -1,6 +1,7 @@
package controllers
import (
   "basic.com/dbapi.git"
   "encoding/json"
   "github.com/gin-gonic/gin"
   "github.com/satori/go.uuid"
@@ -33,9 +34,9 @@
   _, sysconf := setApi.GetServerInfo()
   analyServerFilterStr := ""
   if isSync == "1" {
      analyServerFilterStr = "{\"term\":{\"analyServerId\":\"" + sysconf.ServerId + "\"}}" // 同步库
      analyServerFilterStr = "{\"term\":{\"analyServerId\":\"\"}}" // / 同步库
   } else if isSync == "2" {
      analyServerFilterStr = "{\"term\":{\"analyServerId\":\"\"}}" // / 本地库
      analyServerFilterStr = "{\"term\":{\"analyServerId\":\"" + sysconf.ServerId + "\"}}" // 本地库
   }
   params := "{\"query\":{\"bool\":{\"must\":[" +
      "{\"term\":{\"isDelete\":\"0\"}}" + analyServerFilterStr + "]}}," +
@@ -109,13 +110,13 @@
   c.BindJSON(&dbtable)
   tableId := uuid.NewV4().String()
   dbtable.Id = tableId
   if dbtable.analyServerId == "sync" {
   if dbtable.AnalyServerId == "sync" {
      dbtable.AnalyServerId = ""
   }
   if dbtable.AnalyServerId == "local" {
      var setApi dbapi.SysSetApi
      _, sysconf := setApi.GetServerInfo()
      dbtable.analyServerId = sysconf.ServerId
   }
   if dbtable.analyServerId == "local" {
      dbtable.analyServerId = ""
      dbtable.AnalyServerId = sysconf.ServerId
   }
   url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport +
      "/" + config.EsInfo.EsIndex.DbTables.IndexName + "/" + config.EsInfo.EsIndex.DbTables.IndexType + "/" + tableId + "?refresh=wait_for"