From 24e2d92df7cad99e1e514fa581fe59765dbc4a12 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期五, 02 八月 2019 09:54:33 +0800
Subject: [PATCH] rm discovery server

---
 controllers/dbtableperson.go |  109 ++++++++++++++++++++++++++----------------------------
 1 files changed, 53 insertions(+), 56 deletions(-)

diff --git a/controllers/dbtableperson.go b/controllers/dbtableperson.go
index 3a987c0..bad1888 100644
--- a/controllers/dbtableperson.go
+++ b/controllers/dbtableperson.go
@@ -1,12 +1,10 @@
 package controllers
 
 import (
-	"basic.com/pubsub/protomsg.git"
 	"encoding/json"
 	"log"
 	"strconv"
 	"time"
-	"webserver/discovery"
 	"webserver/extend/logger"
 
 	"github.com/gin-gonic/gin"
@@ -16,7 +14,6 @@
 	"webserver/extend/esutil"
 	"webserver/extend/util"
 	"webserver/models"
-	esApi "basic.com/pubsub/esutil.git"
 )
 
 type DbPersonController struct {
@@ -63,16 +60,16 @@
 	params := string(personbytes)
 	logger.Debug("璇锋眰url:%s;\n 璇锋眰鍙傛暟params:%s", url, params)
 	data, _ := esutil.PutEsDataReq(url, params)
-	if data["_id"] !=""{
-		//閫氱煡姣斿杩涚▼缂撳瓨鏇存柊
-		discovery.AddDbMessage(&protomsg.EsPersonCacheChange{
-			Type: protomsg.EsCacheChanged_T_DbTablePerson,
-			PersonId: personId,
-			TableId: []string{ dbperson.TableId },
-			Feature: dbperson.FaceFeature,
-			Action: protomsg.DbAction_Insert,
-		})
-	}
+	//if data["_id"] !=""{
+	//	//閫氱煡姣斿杩涚▼缂撳瓨鏇存柊
+	//	discovery.AddDbMessage(&protomsg.EsPersonCacheChange{
+	//		Type: protomsg.EsCacheChanged_T_DbTablePerson,
+	//		PersonId: personId,
+	//		TableId: []string{ dbperson.TableId },
+	//		Feature: dbperson.FaceFeature,
+	//		Action: protomsg.DbAction_Insert,
+	//	})
+	//}
 
 	//c.JSON(200, changeEsRespData(data, "娣诲姞浜哄憳鎴愬姛"))
 	result = changeEsRespData(data, "娣诲姞鎴愬姛")
@@ -111,23 +108,23 @@
 	result := changeEsRespData(data, "淇敼鎴愬姛")
 	if result["success"].(bool) {
 		//code.Success.Message = "淇敼搴曞簱浜哄憳鎴愬姛"
-		if dbperson.Enable == 1 {
-			discovery.AddDbMessage(&protomsg.EsPersonCacheChange{
-				Type: protomsg.EsCacheChanged_T_DbTablePerson,
-				PersonId: dbperson.Id,
-				TableId: []string{ dbperson.TableId },
-				Feature: "",
-				Action: protomsg.DbAction_Insert,
-			})
-		} else {
-			discovery.AddDbMessage(&protomsg.EsPersonCacheChange{
-				Type: protomsg.EsCacheChanged_T_DbTablePerson,
-				PersonId: dbperson.Id,
-				TableId: []string{ dbperson.TableId },
-				Feature: "",
-				Action: protomsg.DbAction_Delete,
-			})
-		}
+		//if dbperson.Enable == 1 {
+		//	discovery.AddDbMessage(&protomsg.EsPersonCacheChange{
+		//		Type: protomsg.EsCacheChanged_T_DbTablePerson,
+		//		PersonId: dbperson.Id,
+		//		TableId: []string{ dbperson.TableId },
+		//		Feature: "",
+		//		Action: protomsg.DbAction_Insert,
+		//	})
+		//} else {
+		//	discovery.AddDbMessage(&protomsg.EsPersonCacheChange{
+		//		Type: protomsg.EsCacheChanged_T_DbTablePerson,
+		//		PersonId: dbperson.Id,
+		//		TableId: []string{ dbperson.TableId },
+		//		Feature: "",
+		//		Action: protomsg.DbAction_Delete,
+		//	})
+		//}
 		util.ResponseFormat(c, code.Success, result["data"])
 	} else {
 		//code.ServiceInsideError.Message += result["msg"].(string)
@@ -159,18 +156,18 @@
 	if result["success"].(bool) {
 		//code.Success.Message = "鍒犻櫎搴曞簱浜哄憳鎴愬姛"
 		//閫氱煡姣斿杩涚▼锛屾浜哄凡鍒犻櫎
-		dbperArr, e := esApi.Dbpersoninfosbyid([]string{uuid}, config.EsInfo.EsIndex.Dbtablepersons.IndexName, config.EsInfo.Masterip, config.EsInfo.Httpport)
-		if e ==nil && len(dbperArr) > 0{
-			if dbperArr[0].TableId !=""{
-				discovery.AddDbMessage(&protomsg.EsPersonCacheChange{
-					Type: protomsg.EsCacheChanged_T_DbTablePerson,
-					PersonId: uuid,
-					TableId: []string{ dbperArr[0].TableId },
-					Feature: "",
-					Action: protomsg.DbAction_Delete,
-				})
-			}
-		}
+		//dbperArr, e := esApi.Dbpersoninfosbyid([]string{uuid}, config.EsInfo.EsIndex.Dbtablepersons.IndexName, config.EsInfo.Masterip, config.EsInfo.Httpport)
+		//if e ==nil && len(dbperArr) > 0{
+		//	if dbperArr[0].TableId !=""{
+		//		discovery.AddDbMessage(&protomsg.EsPersonCacheChange{
+		//			Type: protomsg.EsCacheChanged_T_DbTablePerson,
+		//			PersonId: uuid,
+		//			TableId: []string{ dbperArr[0].TableId },
+		//			Feature: "",
+		//			Action: protomsg.DbAction_Delete,
+		//		})
+		//	}
+		//}
 
 		util.ResponseFormat(c, code.Success, result["data"])
 	} else {
@@ -203,20 +200,20 @@
 	//result := changeEsRespData(data, "鍒犻櫎鎴愬姛")
 	if data["error"] == nil {
 		//code.Success.Message = "鍒犻櫎搴曞簱浜哄憳鎴愬姛"
-		dbperArr, e := esApi.Dbpersoninfosbyid(uuids, config.EsInfo.EsIndex.Dbtablepersons.IndexName, config.EsInfo.Masterip, config.EsInfo.Httpport)
-		if e ==nil && len(dbperArr) > 0{
-			for _,esPer :=range dbperArr {
-				if esPer.TableId !=""{
-					discovery.AddDbMessage(&protomsg.EsPersonCacheChange{
-						Type: protomsg.EsCacheChanged_T_DbTablePerson,
-						PersonId: esPer.Id,
-						TableId: []string{ esPer.TableId },
-						Feature: "",
-						Action: protomsg.DbAction_Delete,
-					})
-				}
-			}
-		}
+		//dbperArr, e := esApi.Dbpersoninfosbyid(uuids, config.EsInfo.EsIndex.Dbtablepersons.IndexName, config.EsInfo.Masterip, config.EsInfo.Httpport)
+		//if e ==nil && len(dbperArr) > 0{
+		//	for _,esPer :=range dbperArr {
+		//		if esPer.TableId !=""{
+		//			discovery.AddDbMessage(&protomsg.EsPersonCacheChange{
+		//				Type: protomsg.EsCacheChanged_T_DbTablePerson,
+		//				PersonId: esPer.Id,
+		//				TableId: []string{ esPer.TableId },
+		//				Feature: "",
+		//				Action: protomsg.DbAction_Delete,
+		//			})
+		//		}
+		//	}
+		//}
 		util.ResponseFormat(c, code.Success, "鍒犻櫎搴曞簱浜哄憳鎴愬姛")
 	} else {
 		//code.ServiceInsideError.Message += result["msg"].(string)

--
Gitblit v1.8.0