| | |
| | | package controllers |
| | | |
| | | import ( |
| | | "basic.com/dbapi.git" |
| | | "encoding/json" |
| | | "github.com/gin-gonic/gin" |
| | | "github.com/satori/go.uuid" |
| | |
| | | _, 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 + "]}}," + |
| | |
| | | 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" |