From cc962c1b6ffabd9d41e6db0571efbcc1a4568ce7 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期一, 29 七月 2019 11:39:56 +0800
Subject: [PATCH] use mangos req instead of deliver,add recv timeout

---
 controllers/dbtablesCon.go |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/controllers/dbtablesCon.go b/controllers/dbtablesCon.go
index e2a12e1..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"
@@ -33,9 +34,12 @@
 	_, 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 + "\"}}" // 鏈湴搴�
+	}
+	if analyServerFilterStr !="" {
+		analyServerFilterStr = ","+ analyServerFilterStr
 	}
 	params := "{\"query\":{\"bool\":{\"must\":[" +
 		"{\"term\":{\"isDelete\":\"0\"}}" + analyServerFilterStr + "]}}," +
@@ -109,13 +113,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"

--
Gitblit v1.8.0