From d42b09cda8b2bc58c43c200f3aabdb0b2a7e9211 Mon Sep 17 00:00:00 2001
From: sunty <1172534965@qq.com>
Date: 星期五, 12 七月 2019 12:02:14 +0800
Subject: [PATCH] fix search controllers

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

diff --git a/controllers/dbtablesCon.go b/controllers/dbtablesCon.go
index f6bf747..e74d046 100644
--- a/controllers/dbtablesCon.go
+++ b/controllers/dbtablesCon.go
@@ -66,13 +66,13 @@
 func (dbt DbTableController) UpdateDbTables(c *gin.Context) {
 	dbtable := new(models.Dbtables)
 	c.BindJSON(&dbtable)
-	uuid := c.Params.ByName("uuid")
+	uuid := c.Params.ByName("id")
 	if uuid == "" {
-		uuid = dbtable.Uuid
-		fmt.Println("body涓幏鍙栧簳搴搖uid")
+		uuid = dbtable.Id
+		fmt.Println("body涓幏鍙栧簳搴搃d")
 	}
 	url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport +
-		"/" + config.EsInfo.EsIndex.DbTables.IndexName + "/" + config.EsInfo.EsIndex.DbTables.IndexType + "/" + uuid + "/_update"
+		"/" + config.EsInfo.EsIndex.DbTables.IndexName + "/" + config.EsInfo.EsIndex.DbTables.IndexType + "/" + uuid + "/_update?refresh=wait_for"
 	dbtable.PriUpdate()
 	dbTableByte, err := json.Marshal(dbtable)
 	if err != nil {
@@ -106,9 +106,9 @@
 	dbtable := new(models.Dbtables)
 	c.BindJSON(&dbtable)
 	tableId := uuid.NewV4().String()
-	dbtable.Uuid = tableId
+	dbtable.Id = tableId
 	url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport +
-		"/" + config.EsInfo.EsIndex.DbTables.IndexName + "/" + config.EsInfo.EsIndex.DbTables.IndexType + "/" + tableId
+		"/" + config.EsInfo.EsIndex.DbTables.IndexName + "/" + config.EsInfo.EsIndex.DbTables.IndexType + "/" + tableId + "?refresh=wait_for"
 	dbtable.PriInsert() // 娣诲姞鏃堕棿鍜屽垱寤轰汉
 	dbTableByte, err := json.Marshal(dbtable)
 	if err != nil {
@@ -137,11 +137,11 @@
 // @Param uuid path string true "搴曞簱id "
 // @Success 200 {string} json "{"code":200, msg:"鐩綍缁撴瀯鏁版嵁", success:true}"
 // @Failure 500 {string} json "{"code":500,  msg:"杩斿洖閿欒淇℃伅", success:false}"
-// @Router /data/api-v/dbtable/deleteDBtablesById/{uuid} [POST]
+// @Router /data/api-v/dbtable/deleteDBtablesById/{id} [POST]
 func (dbt DbTableController) DeleteDbTables(c *gin.Context) {
-	uuid := c.Params.ByName("uuid")
+	uuid := c.Params.ByName("id")
 	url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport +
-		"/" + config.EsInfo.EsIndex.DbTables.IndexName + "/" + config.EsInfo.EsIndex.DbTables.IndexType + "/" + uuid + "/_update"
+		"/" + config.EsInfo.EsIndex.DbTables.IndexName + "/" + config.EsInfo.EsIndex.DbTables.IndexType + "/" + uuid + "/_update?refresh=wait_for"
 	params := "{\"doc\":{\"isDelete\":\"1\"}}"
 	fmt.Print("鍒犻櫎璇锋眰url:%s;\n 璇锋眰鍙傛暟params:%s", url, params)
 	data := esutil.GetEsDataReq(url, params, false)

--
Gitblit v1.8.0