From 1ca4879df9cc3c22181b2a200aa4b793116d3d35 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期六, 19 十月 2024 16:23:55 +0800
Subject: [PATCH] fix id
---
model/model.go | 9 +--------
service/server.go | 10 +++++-----
main.go | 4 ++--
3 files changed, 8 insertions(+), 15 deletions(-)
diff --git a/main.go b/main.go
index d9364c8..a71a4de 100644
--- a/main.go
+++ b/main.go
@@ -65,9 +65,9 @@
}
id, err := service.SendData(result, url)
- logger.Debug("鎺ㄩ�佺殑鏁版嵁 id: ", id)
+ logger.Debug("鎺ㄩ�佺殑鏁版嵁 id: ", result.PicId)
if err == nil {
- markStatus := service.MarkData(id)
+ markStatus := service.MarkData(result.PicId)
logger.Debug("璁板綍鎺ㄩ�佺姸鎬� markStatus: ", markStatus)
} else {
logger.Debugf("鎺ㄩ�佺殑鏁版嵁澶辫触 id: %s, err:%s", id, err.Error())
diff --git a/model/model.go b/model/model.go
index 7016d1c..d7a8fe3 100644
--- a/model/model.go
+++ b/model/model.go
@@ -12,13 +12,6 @@
PicSmImages: nil,
}
-var PushDataInfoV2 = &pushDataInfoV2{
- PicMaxImages: nil,
- PicSmImages: nil,
- CameraFloor: "",
- DataSource: "smart-ai",
-}
-
type BaseCompareInfo struct {
BwType string `json:"bwType"`
TableId string `json:"tableId"`
@@ -66,7 +59,7 @@
PicH int `json:"picH"`
}
-type pushDataInfoV2 struct {
+type PushDataInfoV2 struct {
CameraId string `json:"cameraId"`
CameraFloor string `json:"cameraFloor"` //鎽勫儚鏈烘ゼ灞�
Direction string `json:"direction"` // 鎽勫儚鏈鸿繍琛屾柟鍚� up or down
diff --git a/service/server.go b/service/server.go
index 3f56b0b..6f15812 100644
--- a/service/server.go
+++ b/service/server.go
@@ -65,7 +65,7 @@
return totals, nil
}
-func GetData() (interface{}, error) {
+func GetData() (*model.PushDataInfoV2, error) {
//fmt.Println(config.Options.EsUrl)
//fmt.Println(config.Options.ServerUrl)
url := "http://" + config.Options.EsUrl + "/ai_face_ocean/_search"
@@ -137,10 +137,10 @@
return nil, errors.New("鑾峰彇灏忓浘鏁版嵁澶辫触, id:" + esInfoV2.Id)
}
- var pushData = model.PushDataInfoV2
+ var pushData = new(model.PushDataInfoV2)
pushData.CameraId = esInfoV2.CameraId
pushData.PicDate = esInfoV2.PicDate
- pushData.PicId = esInfoV2.PicId
+ pushData.PicId = esInfoV2.Id
pushData.CameraFloor = esInfoV2.CameraLocation.Floor
pushData.Direction = esInfoV2.CameraLocation.Direction
pushData.PicMaxImages = append(pushData.PicMaxImages, picMaxImages)
@@ -193,7 +193,7 @@
}
func DeleteData(id string) bool {
- url := "http://" + config.Options.EsUrl + "/ai_ocean/_delete_by_query?refresh=true"
+ url := "http://" + config.Options.EsUrl + "/ai_face_ocean/_delete_by_query?refresh=true"
deleteDSL := `{
"query":{
"bool":{
@@ -220,7 +220,7 @@
}
func MarkData(id string) bool {
- url := "http://" + config.Options.EsUrl + "/ai_ocean/_update_by_query?refresh=true"
+ url := "http://" + config.Options.EsUrl + "/ai_face_ocean/_update_by_query?refresh=true"
markDSL := `{
"script": {
"source": "ctx._source.isDelete=true"
--
Gitblit v1.8.0