zhangzengfei
2024-10-19 1ca4879df9cc3c22181b2a200aa4b793116d3d35
fix id
3个文件已修改
23 ■■■■■ 已修改文件
main.go 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/model.go 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/server.go 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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())
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
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"