From 053b9672b1d8eaa238c95acbd946056c181e6834 Mon Sep 17 00:00:00 2001
From: panlei <2799247126@qq.com>
Date: 星期一, 08 七月 2019 20:32:38 +0800
Subject: [PATCH] 加配置文件

---
 go.sum                       |    2 ++
 insertdata/insertDataToEs.go |   15 ++++++++++++++-
 go.mod                       |    1 +
 config/conf.yml              |    1 +
 4 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/config/conf.yml b/config/conf.yml
new file mode 100644
index 0000000..2bb51ae
--- /dev/null
+++ b/config/conf.yml
@@ -0,0 +1 @@
+photoUrl: "http://192.168.1.182:6333/submit"
\ No newline at end of file
diff --git a/go.mod b/go.mod
index 3f2a642..c148765 100644
--- a/go.mod
+++ b/go.mod
@@ -11,6 +11,7 @@
 	basic.com/valib/gosdk.git v0.0.0-20190531034110-0062fdaaa05a // indirect
 	github.com/Microsoft/go-winio v0.4.12 // indirect
 	github.com/ajg/form v1.5.1 // indirect
+	github.com/go-yaml/yaml v2.1.0+incompatible
 	github.com/gogo/protobuf v1.2.1
 	github.com/golang/protobuf v1.3.1
 	github.com/gorilla/websocket v1.4.0 // indirect
diff --git a/go.sum b/go.sum
index 4bb07c3..11685b9 100644
--- a/go.sum
+++ b/go.sum
@@ -17,6 +17,8 @@
 github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/go-yaml/yaml v2.1.0+incompatible h1:RYi2hDdss1u4YE7GwixGzWwVo47T8UQwnTLB6vQiq+o=
+github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0=
 github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE=
 github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
 github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
diff --git a/insertdata/insertDataToEs.go b/insertdata/insertDataToEs.go
index 0fae6ec..5fb10f5 100644
--- a/insertdata/insertDataToEs.go
+++ b/insertdata/insertDataToEs.go
@@ -4,6 +4,7 @@
 	"encoding/json"
 	"errors"
 	"fmt"
+	"io/ioutil"
 	"net"
 	"ruleprocess/cache"
 	"ruleprocess/logger"
@@ -15,9 +16,20 @@
 	"github.com/satori/go.uuid"
 	"ruleprocess/ruleserver"
 	"ruleprocess/util"
+	"github.com/go-yaml/yaml"
 )
+var weedfsUrl string
+type conf struct {
+	PhotoUrl string
+}
+func init() {
+	data, _ := ioutil.ReadFile("conf.yml")
+	c := conf{}
+	//鎶妝aml褰㈠紡鐨勫瓧绗︿覆瑙f瀽鎴恠truct绫诲瀷
+	yaml.Unmarshal(data, &c)
+	weedfsUrl = c.PhotoUrl
+}
 
-var weedfsUrl = "http://192.168.1.182:6333/submit"
 // 浜鸿劯鐨勬暟鎹粨鏋�
 type PerVideoPicture struct {
 	Id              string   `json:"id"`
@@ -84,6 +96,7 @@
 func InsertToEs(msg ruleserver.ResultMsg) {
 
 	// 鐩存帴浠庤鍒欑殑鏍囩鏁版嵁閲屾嬁绗﹀悎瑙勫垯鐨勪汉鑴哥粨鏋�
+	logger.Info("------------------------------------浠庨厤缃枃浠惰鍙栫殑鍊硷細",weedfsUrl)
 	if msg.RuleResult["face"] != nil && len(msg.RuleResult["face"].([]ruleserver.Arg)) > 0 {
 		logger.Info("寰�ES鎻掍汉鑴告暟鎹�")
 		for _, face := range msg.RuleResult["face"].([]ruleserver.Arg) {

--
Gitblit v1.8.0