From 1c6fac405125468cfd2321d8ab9dc8bb0350861f Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期三, 13 十一月 2019 19:26:16 +0800 Subject: [PATCH] fix --- service/CamraUpdatesnashot.go | 12 +++++++++--- service/EnableStatusControlService.go | 23 ++++++++++++++++------- service/CameraVideoService.go | 10 +++++++++- 3 files changed, 34 insertions(+), 11 deletions(-) diff --git a/service/CameraVideoService.go b/service/CameraVideoService.go index 907dd8e..8a158f2 100644 --- a/service/CameraVideoService.go +++ b/service/CameraVideoService.go @@ -1,8 +1,11 @@ package service import ( + "basic.com/valib/logger.git" "encoding/json" "fmt" + "strconv" + "webserver/cache" "webserver/extend/config" "webserver/extend/esutil" "webserver/models" @@ -10,7 +13,12 @@ // 鍦板簱浜哄憳鏁版嵁 涓� 姣斿鍋氬噯澶� func QueryDbPersonsForCompare(reqBody models.EsSearch) map[string]interface{} { - url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport + + localConf, err2 := cache.GetServerInfo() + if err2 !=nil || localConf.AlarmIp == "" || localConf.ServerId == "" { + logger.Debug("localConfig is wrong!!!") + return nil + } + url := "http://" + localConf.AlarmIp + ":" + strconv.Itoa(int(localConf.AlarmPort)) + "/" + config.EsInfo.EsIndex.Dbtablepersons.IndexName + "/_search" tableIds := make([]string, 20) if reqBody.DataBases != nil { diff --git a/service/CamraUpdatesnashot.go b/service/CamraUpdatesnashot.go index 0ca5c58..6e68767 100644 --- a/service/CamraUpdatesnashot.go +++ b/service/CamraUpdatesnashot.go @@ -4,9 +4,10 @@ "basic.com/dbapi.git" "basic.com/fileServer/WeedFSClient.git" "basic.com/valib/capture.git" + "basic.com/valib/logger.git" "errors" "strconv" - "webserver/extend/config" + "webserver/cache" ) /*浠ヤ笅灞炰簬鏃х増鏈湴鎽勫儚鏈鸿幏鍙栨埅鍥撅紙鍥芥爣鎽勫儚鏈哄簳鍥炬棤娉曞埛鏂帮級 func PostFormBufferData(uri string, filepath string, fileName string) (maps map[string]interface{}, err0 error) { @@ -143,9 +144,14 @@ if camera.Type == 1{//鍥芥爣鎽勫儚鏈� m = capture.GB28181 } - b,err := capture.Capture("./runtime/libcffmpeg.so",m,camera.Rtsp,capture.JPEGFileExt,1280,720,10) + b,err := capture.Capture("libcffmpeg.so",m,camera.Rtsp,capture.JPEGFileExt,1280,720,10) if err == nil{ - var weedfsUri = "http://"+config.WeedFs.Ip+":"+strconv.Itoa(config.WeedFs.UploadPort)+"/submit" + localConf, err2 := cache.GetServerInfo() + if err2 !=nil || localConf.WebPicIp == "" { + logger.Debug("localConfig is wrong!!!") + return "",err2 + } + var weedfsUri = "http://"+localConf.WebPicIp+":"+strconv.Itoa(int(localConf.WebPicPort))+"/submit" weedFilePath, err := WeedFSClient.UploadFile(weedfsUri, camera.Name+".jpg", b) if err != nil { return "",err diff --git a/service/EnableStatusControlService.go b/service/EnableStatusControlService.go index 0c760b7..a0439b1 100644 --- a/service/EnableStatusControlService.go +++ b/service/EnableStatusControlService.go @@ -1,22 +1,26 @@ package service import ( - "basic.com/dbapi.git" + "basic.com/valib/logger.git" "encoding/json" "fmt" "strconv" "strings" "time" + "webserver/cache" "webserver/extend/config" "webserver/extend/esutil" - "webserver/extend/logger" ) func GetVerificationData() []map[string]interface{} { - url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport + + localConf, err2 := cache.GetServerInfo() + if err2 !=nil || localConf.AlarmIp == "" || localConf.ServerId == "" { + logger.Debug("localConfig is wrong!!!") + return nil + } + url := "http://" + localConf.AlarmIp + ":" + strconv.Itoa(int(localConf.AlarmPort)) + "/" + config.EsInfo.EsIndex.DbTables.IndexName + "/_search" - var setApi dbapi.SysSetApi - _, sysconf := setApi.GetServerInfo() + jsonDSL := `{ "query": { "bool": { @@ -27,7 +31,7 @@ }, { "terms": { - "analyServerId": ["` + sysconf.ServerId + `",""] + "analyServerId": ["` + localConf.ServerId + `",""] } } ] @@ -83,7 +87,12 @@ status = 1 } enable := strconv.Itoa(status) - url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport + + localConf, err2 := cache.GetServerInfo() + if err2 !=nil || localConf.AlarmIp == "" || localConf.ServerId == "" { + logger.Debug("localConfig is wrong!!!") + return "localConf wrong" + } + url := "http://" + localConf.AlarmIp + ":" + strconv.Itoa(int(localConf.AlarmPort)) + "/" + config.EsInfo.EsIndex.DbTables.IndexName + "/_update_by_query?refresh" jsonDsl := ` { -- Gitblit v1.8.0