---
panlei
2019-07-09 fc87731788af22601270789e935cf068edc80f79
insertdata/insertDataToEs.go
@@ -4,6 +4,7 @@
   "encoding/json"
   "errors"
   "fmt"
   "io/ioutil"
   "net"
   "ruleprocess/cache"
   "ruleprocess/logger"
@@ -15,9 +16,22 @@
   "github.com/satori/go.uuid"
   "ruleprocess/ruleserver"
   "ruleprocess/util"
   "github.com/go-yaml/yaml"
)
var weedfsUrl string
type conf struct {
   PhotoUrl string
}
func init() {
   logger.Info("_________________________________________老子想看你执行了没")
   fmt.Println("_________________________________________老子想看你执行了没")
   data, _ := ioutil.ReadFile("conf.yml")
   c := conf{}
   //把yaml形式的字符串解析成struct类型
   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 +98,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) {