qixiaoning
2025-08-11 ad4ad76f4cd6db55ddceedcff5bf588547786f31
推送配置相关接口修改调整字段设置,数据关联
6个文件已修改
54 ■■■■■ 已修改文件
camera-common/models/task.go 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
camera-service/controllers/camera.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
push-service/controllers/eventPush.go 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
push-service/controllers/pushSet.go 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
push-service/service/eventPushService.go 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
push-service/vo/eventPush.go 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
camera-common/models/task.go
@@ -12,6 +12,12 @@
    TaskName string `db:"task_name" json:"taskName"`
}
type TaskAggregate struct {
    ID       int64  `gorm:"column:task_id" json:"id"`
    Name     string `gorm:"column:task_name"  json:"name"`
    IsDelete int8   `json:"isDelete"`
}
type TaskM struct {
    TaskId          int64  `db:"task_id" json:"taskId"`
    TaskName        string `db:"task_name" json:"taskName"`
@@ -46,7 +52,7 @@
}
// 查询列表数据
func GetAllTask() (items []Task, err error) {
func GetAllTask() (items []TaskAggregate, err error) {
    // 主查询SQL
    sqlStr := fmt.Sprintf(`
        SELECT task_id, task_name
camera-service/controllers/camera.go
@@ -1216,7 +1216,7 @@
func (cc CameraController) GetAllTasks(h *bhomeclient.WrapperHandler, c *bhomeclient.Request) *bhomeclient.Reply {
    //绑定json和结构体
    var tasks []models.Task
    var tasks []models.TaskAggregate
    tasks, _ = models.GetAllTask()
    return &bhomeclient.Reply{Success: true, Msg: "获取成功", Data: tasks}
push-service/controllers/eventPush.go
@@ -1,16 +1,15 @@
package controllers
import (
    "basic.com/valib/bhomeclient.git"
    "basic.com/valib/logger.git"
    "vamicro/push-service/service"
    "vamicro/push-service/vo"
    "basic.com/valib/bhomeclient.git"
    "basic.com/valib/logger.git"
)
type EventPushController struct {
}
// @Summary 事件推送保存
// @Description 事件推送保存
push-service/controllers/pushSet.go
@@ -83,23 +83,14 @@
        Checked: true,
        Children: []vo.PushSetMenu{
            {Checked: true, Id: "id", Name: "主键ID", Alias: "id"},
            {Checked: true, Id: "isDelete", Name: "是否删除", Alias: "isDelete"},
            {Checked: true, Id: "likeDate", Name: "比对时间", Alias: "likeDate"},
            {Checked: true, Id: "picDate", Name: "抓拍时间", Alias: "picDate"},
            {Checked: true, Id: "updateTime", Name: "更新时间", Alias: "updateTime"},
            {Checked: true, Id: "picMaxUrl", Name: "告警全景图地址", Alias: "picMaxUrl"},
            {Checked: true, Id: "picSrcUrl", Name: "原始全景图地址", Alias: "picSrcUrl"},
            {Checked: true, Id: "picId", Name: "图片ID", Alias: "picId"},
            {Checked: true, Id: "picWH.picH", Name: "图片高", Alias: "picH"},
            {Checked: true, Id: "picWH.picW", Name: "图片宽", Alias: "picW"},
            {Checked: true, Id: "sdkName", Name: "sdk类型", Alias: "sdkName"},
            {Checked: true, Id: "videoUrl", Name: "录像地址", Alias: "videoUrl"},
            {Checked: true, Id: "content", Name: "场景名称", Alias: "content"},
            {Checked: true, Id: "linkTag", Name: "联动任务标志", Alias: "linkTag"},
            {Checked: true, Id: "otherLabels", Name: "其他标签", Alias: "otherLebels"},
            {Checked: true, Id: "showLabels", Name: "算法标签", Alias: "showLabels"},
            {Checked: true, Id: "version", Name: "索引版本", Alias: "version"},
            {Checked: true, Id: "isAlarm", Name: "是否报警", Alias: "isAlarm"},
            {Checked: true, Id: "detect_time", Name: "创建时间", Alias: "detect_time"},
            {Checked: true, Id: "zh_desc_class", Name: "中文描述", Alias: "zh_desc_class"},
            {Checked: true, Id: "image_path", Name: "图像地址", Alias: "image_path"},
            {Checked: true, Id: "video_path", Name: "录像地址", Alias: "video_path"},
            {Checked: true, Id: "event_level_name", Name: "事件等级", Alias: "event_level_name"},
            {Checked: true, Id: "suggestion", Name: "处理建议", Alias: "suggestion"},
            {Checked: true, Id: "risk_description", Name: "隐患描述", Alias: "risk_description"},
            {Checked: true, Id: "is_warning", Name: "是否预警", Alias: "is_warning"},
        },
    }
    // detectAreaSet := vo.PushSetMenu{
push-service/service/eventPushService.go
@@ -11,6 +11,7 @@
    "basic.com/pubsub/protomsg.git"
    "basic.com/valib/bhomeclient.git"
    "basic.com/valib/bhomedbapi.git"
    "basic.com/valib/logger.git"
    uuid "github.com/satori/go.uuid"
)
@@ -83,10 +84,12 @@
    } else { //新增
        if er > 0 {
            err = errors.New("名称不允许重复")
            logger.Debug(err)
            return false
        }
        eventPushE.Id = uuid.NewV4().String()
        if err = tx.Table("event_push").Create(&eventPushE).Error; err != nil {
            logger.Debug(err)
            return false
        }
    }
@@ -102,6 +105,7 @@
            EventPushId: eventPushE.Id,
        }
        if err = tx.Table("event_push_server").Create(&ipPortE).Error; err != nil {
            logger.Debug(err)
            return false
        }
    }
@@ -110,18 +114,24 @@
            Id:          uuid.NewV4().String(),
            Enable:      urlVo.Enable,
            Url:         urlVo.Url,
            ServerIp:    urlVo.ServerIp,
            Port:        urlVo.Port,
            Type:        models.PUSH_URL_TYPE,
            EventPushId: eventPushE.Id,
        }
        if err = tx.Table("event_push_server").Create(&urlE).Error; err != nil {
            logger.Debug(err)
            return false
        }
    }
    logger.Debug("hhhhhhh")
    for _, rule := range body.Rules {
        rule.Id = uuid.NewV4().String()
        rule.EventPushId = eventPushE.Id
        if err = tx.Table("event_push_rule").Create(&rule).Error; err != nil {
            logger.Debug(err)
            return false
        }
    }
push-service/vo/eventPush.go
@@ -42,6 +42,8 @@
type EventUrlVo struct {
    Url    string `json:"url"`
    ServerIp string `json:"server_ip"`
    Port     int    `json:"port"`
    Enable bool   `json:"enable"`
}