From 5cb53f7064acab1c58f0020e620e1f9ee2f1d5d9 Mon Sep 17 00:00:00 2001
From: panlei <2799247126@qq.com>
Date: 星期四, 07 十一月 2019 10:32:55 +0800
Subject: [PATCH] 推送视频地址新方案(不推送)

---
 insertdata/insertDataToEs.go |   18 ++++++++----------
 ruleserver/attachInfo.go     |   28 ++++++++++++++--------------
 2 files changed, 22 insertions(+), 24 deletions(-)

diff --git a/insertdata/insertDataToEs.go b/insertdata/insertDataToEs.go
index a77c422..ba89ac2 100644
--- a/insertdata/insertDataToEs.go
+++ b/insertdata/insertDataToEs.go
@@ -218,7 +218,7 @@
 				race := getRaceString(face.ThftRes.Race)
 				ageDescription := getDescription(face.ThftRes.Age)
 				logger.Info(ageDescription)
-				esDataId := uuid.NewV4().String()
+				//esDataId := uuid.NewV4().String()
 				linksId := ""
 				if linkId != "" {
 					linksId = linkId
@@ -230,7 +230,7 @@
 				//logger.Info("浜鸿劯鐨刬d:",strconv.FormatUint(face.Id, 10))
 				logger.Info("%%%%%%%%%%%%%%%%%%%%%鐩爣淇℃伅锛�",*target)
 				pervideo := PerVideoPicture{
-					esDataId,
+					msg.Push.PushId,
 					msg.Cid,
 					msg.Push.Cam.Addr,
 					picTime,
@@ -249,7 +249,7 @@
 					face.ThftRes.Beauty,
 					base64.StdEncoding.EncodeToString(face.Feature),
 					[]string{resp["fileUrl"].(string)},
-					msg.Push.VideoUrl,
+					"",
 					msg.Push.ServerId,
 					msg.Push.ServerName,
 					msg.Push.LocalIp,
@@ -275,7 +275,7 @@
 				} else {
 					logger.Info("鎻掑叆es杩斿洖鐨勪俊鎭細", resp1)
 					// 鍙戝嚭褰曞儚淇″彿
-					ruleserver.AddLxMessage(&protomsg.VideotapeInfo{EsDataId: esDataId, CameraId: msg.Cid, TaskId: msg.Tasklab.Taskid, VideoUrl:msg.Push.VideoUrl,ImgId: i.Id, SdkIds: []string{}, Type: 1})
+					ruleserver.AddLxMessage(&protomsg.VideotapeInfo{EsDataId: msg.Push.PushId, CameraId: msg.Cid, TaskId: msg.Tasklab.Taskid, VideoUrl:msg.Push.VideoUrl,ImgId: i.Id, SdkIds: []string{}, Type: 1})
 				}
 			}
 		}
@@ -445,13 +445,13 @@
 
 			if resp["fileUrl"] != nil {
 				url = append(url, resp["fileUrl"].(string))
-				esDataId := uuid.NewV4().String()
+				//esDataId := uuid.NewV4().String()
 				linksId := ""
 				if linkId != "" {
 					linksId = linkId
 				}
 				peraction := Personaction{
-					esDataId,
+					msg.Push.PushId,
 					msg.Cid,
 					msg.Push.Cam.Name,
 					msg.Push.Cam.Addr,
@@ -467,7 +467,7 @@
 					url,
 					i.Timestamp,
 					linksId,
-					msg.Push.VideoUrl,
+					"",
 					isAlarm,
 					0,
 					0,
@@ -479,7 +479,6 @@
 				if err != nil {
 					logger.Info("json parse error ", err)
 					return
-
 				}
 				resp1, err2 := EsReq("POST", personAction, requstbody)
 				if err2 != nil {
@@ -487,8 +486,7 @@
 				} else {
 					logger.Debug("鎻掑叆es杩斿洖鐨勬暟鎹俊鎭槸锛�", resp1)
 					// 鍙戝嚭褰曞儚淇″彿
-					logger.Info("缁欏綍鍍忕殑瑙嗛鍦板潃锛�",msg.Push.VideoUrl)
-					ruleserver.AddLxMessage(&protomsg.VideotapeInfo{EsDataId: esDataId, CameraId: msg.Cid, TaskId: msg.Tasklab.Taskid,VideoUrl:msg.Push.VideoUrl, ImgId: i.Id, SdkIds: []string{}, Type: 2})
+					ruleserver.AddLxMessage(&protomsg.VideotapeInfo{EsDataId: msg.Push.PushId, CameraId: msg.Cid, TaskId: msg.Tasklab.Taskid,VideoUrl:msg.Push.VideoUrl, ImgId: i.Id, SdkIds: []string{}, Type: 2})
 					logger.Warn("__________________________________________寰�ES鎻掑叆yolo鏁版嵁鎴愬姛")
 					//os.Exit(1)
 				}
diff --git a/ruleserver/attachInfo.go b/ruleserver/attachInfo.go
index f0c33c9..3660306 100644
--- a/ruleserver/attachInfo.go
+++ b/ruleserver/attachInfo.go
@@ -3,9 +3,8 @@
 import (
 	"basic.com/pubsub/protomsg.git"
 	"basic.com/valib/logger.git"
+	uuid "github.com/satori/go.uuid"
 	"ruleprocess/cache"
-	"basic.com/fileserver/WeedFSClient.git"
-	"strconv"
 )
 func GetAttachInfo(msg *protomsg.SdkMessage){
 	//浜鸿劯妫�娴嬶紝娌℃湁鐩镐技鐨勫簳搴撲汉鍛�
@@ -25,18 +24,19 @@
 		logger.Error("鏌ヨ鎽勫儚鏈轰俊鎭け璐�")
 	}
 	push.Cam = &camera
+	msg.Push.PushId = uuid.NewV4().String()
 	// 瑙嗛鍦板潃鍗犱綅绗�
-	localConfig1, err := cache.GetServerInfo()
-	if err != nil {
-		panic("閰嶇疆鏂囦欢涓嶅悎娉�")
-	}
-	logger.Info("璇锋眰瑙嗛璺緞锛�",msg.Push,serverIp,camera)
-	weedfsUrl := "http://" + localConfig1.WebPicIp + ":" + strconv.Itoa(int(localConfig1.WebPicPort)) + "/dir/assign"
-	if path,err := WeedFSClient.GetFid(weedfsUrl);err != nil {
-		logger.Info("璇锋眰鏂囦欢鍦板潃澶辫触:",err)
-	} else {
-		logger.Info("瑙嗛璺緞涓猴細",path)
-		push.VideoUrl = path
-	}
+	//localConfig1, err := cache.GetServerInfo()
+	//if err != nil {
+	//	panic("閰嶇疆鏂囦欢涓嶅悎娉�")
+	//}
+	//logger.Info("璇锋眰瑙嗛璺緞锛�",msg.Push,serverIp,camera)
+	// weedfsUrl := "http://" + localConfig1.WebPicIp + ":" + strconv.Itoa(int(localConfig1.WebPicPort)) + "/dir/assign"
+	//if path,err := WeedFSClient.GetFid(weedfsUrl);err != nil {
+	//	logger.Info("璇锋眰鏂囦欢鍦板潃澶辫触:",err)
+	//} else {
+	//	logger.Info("瑙嗛璺緞涓猴細",path)
+	//	push.VideoUrl = path
+	//}
 	msg.Push = push
 }
\ No newline at end of file

--
Gitblit v1.8.0