| | |
| | | "encoding/json" |
| | | "errors" |
| | | "net" |
| | | "ruleprocess/insertdata" |
| | | "strconv" |
| | | "time" |
| | | |
| | |
| | | } |
| | | if key == "track" && len(face.Liker) == 1{ |
| | | esid := face.Liker[0].TargetId |
| | | returnMsg, err1 := esutil.AppendTargetInfo(esid, string(requstbody),EsInfo.EsIndex.AIOcean.IndexName,serverIp,serverPort) |
| | | returnMsg, err1 := esutil.AppendTargetInfo(esid, string(requstbody),structure.EsInfo.EsIndex.AIOcean.IndexName,serverIp,serverPort) |
| | | if err1 != nil { |
| | | logger.Error("追加数据出错!---", err1) |
| | | } else { |
| | |
| | | ruleserver.AddLxMessage(&protomsg.VideotapeInfo{EsDataId: face.Uuid, CameraId: msg.Cid, TaskId: msg.Tasklab.Taskid, VideoUrl: msg.Push.VideoUrl, ImgId: i.Id, SdkIds: []string{"-1"}, Type: 1}) |
| | | } |
| | | } else { |
| | | resp1, err1 := EsReq("POST", videoPersonUrl, requstbody) |
| | | resp1, err1 := insertdata.EsReq("POST", videoPersonUrl, requstbody) |
| | | if err1 != nil { |
| | | logger.Error("上传ES出错!---", err1) |
| | | } else { |
| | |
| | | logger.Info("json parse error ", err) |
| | | return |
| | | } |
| | | resp1, err2 := EsReq("POST", videoPersonUrl, requstbody) |
| | | resp1, err2 := insertdata.EsReq("POST", videoPersonUrl, requstbody) |
| | | if err2 != nil { |
| | | logger.Error("往ES插入数据失败", err) |
| | | } else { |
| | |
| | | logger.Info("json parse error ", err) |
| | | return |
| | | } |
| | | resp1, err2 := EsReq("POST", videoPersonUrl, requstbody) |
| | | resp1, err2 := insertdata.EsReq("POST", videoPersonUrl, requstbody) |
| | | if err2 != nil { |
| | | logger.Error("往ES插入数据失败", err) |
| | | } else { |
| | |
| | | go build -buildmode=plugin -o ./algorithm/personUnsual.so ./algorithm/personUnsual/personUnsual.go |
| | | go build -buildmode=plugin -o ./algorithm/intrusion.so ./algorithm/intrusion/intrusion.go |
| | | go build -buildmode=plugin -o ./algorithm/plate.so ./algorithm/car/plate.go |
| | | go build -buildmode=plugin -o ./algorithm/insertEs.so ./algorithm/insertEs/insertDataToEs.go |
| | | go build |
| | |
| | | |
| | | import ( |
| | | "plugin" |
| | | "ruleprocess/cache" |
| | | "basic.com/valib/logger.git" |
| | | "ruleprocess/structure" |
| | | "strconv" |
| | | ) |
| | | |
| | | |
| | | var weedfsUrl, videoPersonUrl, personAction string |
| | | var serverIp string |
| | | var serverPort string |
| | | func InsertToEs(msg structure.ResultMsg) { |
| | | defer func() { |
| | | if err := recover(); err != nil { |
| | | logger.Error("es模块儿的异常捕获:", err) |
| | | } |
| | | }() |
| | | localConfig1, err := cache.GetServerInfo() |
| | | if err != nil { |
| | | panic("配置文件不合法") |
| | | } |
| | | weedfsUrl = "http://" + localConfig1.WebPicIp + ":" + strconv.Itoa(int(localConfig1.WebPicPort)) + "/submit" |
| | | videoPersonUrl = "http://" + localConfig1.AlarmIp + ":" + strconv.Itoa(int(localConfig1.AlarmPort)) + "/" + structure.EsInfo.EsIndex.AIOcean.IndexName + "/" + structure.EsInfo.EsIndex.AIOcean.IndexType+"?refresh=true" |
| | | serverIp = localConfig1.AlarmIp |
| | | serverPort = strconv.Itoa(int(localConfig1.AlarmPort)) |
| | | |
| | | } |
| | | |
| | | func handle (msg structure.ResultMsg,weedfsUrl,videoPersonUrl,serverIp,serverPort string) { |
| | | p,err := plugin.Open("./algorithm/insertEs.so") |
| | | if err != nil { |
| | | panic(err) |
| | |
| | | if err1 != nil { |
| | | panic("没有找到中间件的格式化数据函数") |
| | | } |
| | | f.(func(msg structure.ResultMsg))(msg) |
| | | f.(func(msg structure.ResultMsg,weedfsUrl,videoPersonUrl,serverIp,serverPort string))(msg,weedfsUrl,videoPersonUrl,serverIp,serverPort) |
| | | } |
| | |
| | | flag.Parse() |
| | | // 日志初始化 |
| | | |
| | | insertdata.Init(*env) |
| | | structure.Init(*env) |
| | | var logFile = "./logger/" |
| | | if viper.GetString("LogBasePath") != "" { |
| | | logFile = viper.GetString("LogBasePath") |
File was renamed from algorithm/insertEs/config.go |
| | |
| | | package insertdata |
| | | package structure |
| | | |
| | | import ( |
| | | "github.com/spf13/viper" |