From 05f96119b4d2e73316f221b08554a7de543fb0d5 Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期六, 27 七月 2019 16:15:51 +0800 Subject: [PATCH] fix compare sdkName=人脸 --- controllers/dbtablesCon.go | 24 +++++++++++++++++++----- 1 files changed, 19 insertions(+), 5 deletions(-) diff --git a/controllers/dbtablesCon.go b/controllers/dbtablesCon.go index 9a3cf28..f47c7d8 100644 --- a/controllers/dbtablesCon.go +++ b/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" @@ -29,15 +30,20 @@ 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\":\"\"}}" // / 鍚屾搴� } else if isSync == "2" { - syncTerm = ",{\"term\":{\"isSync\":\"2\"}}" // / 鏈湴搴� + analyServerFilterStr = "{\"term\":{\"analyServerId\":\"" + sysconf.ServerId + "\"}}" // 鏈湴搴� + } + if analyServerFilterStr !="" { + analyServerFilterStr = ","+ analyServerFilterStr } 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 +113,14 @@ c.BindJSON(&dbtable) tableId := uuid.NewV4().String() dbtable.Id = tableId + if dbtable.AnalyServerId == "sync" { + dbtable.AnalyServerId = "" + } + if dbtable.AnalyServerId == "local" { + var setApi dbapi.SysSetApi + _, sysconf := setApi.GetServerInfo() + 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" dbtable.PriInsert() // 娣诲姞鏃堕棿鍜屽垱寤轰汉 -- Gitblit v1.8.0