qixiaoning
2025-09-11 397468ddc1191bf0ce9339e544ff345d1d4e6786
camera-service/controllers/camera.go
@@ -7,6 +7,7 @@
   "fmt"
   "image"
   "path/filepath"
   "time"
   // "fmt"
   // "io/ioutil"
@@ -85,7 +86,26 @@
   }
   logger.Debug("update sensors:", camVo.Sensors)
   sv := service.CameraService{}
   ok, cam := sv.GetById(camVo.Id)
   if b, err := sv.CameraUpdate(camVo); b {
      //更新分辨率
      if ok {
         logger.Debug("DoPostRequest:", camVo)
         if cam.IsRunning && (cam.ResolutionWidth != camVo.ResolutionWidth && cam.ResolutionHeight != camVo.ResolutionHeight) {
            header := map[string]string{}
            paramBody := map[string]interface{}{
               "isOpen":    1,
               "videoId":   camVo.Id,
               "videoType": 0,
            }
            res, err := util.DoPostRequest("http://127.0.0.1:8088/v1/task/openAnalysis", util.CONTENT_TYPE_JSON, paramBody, nil, header, time.Second*10)
            if err != nil {
               logger.Debug("DoPostRequest err:", err)
            }
            logger.Debug("DoPostRequest:", res)
         }
      }
      cc.addDbChangeMsg(h.Bk, protomsg.TableChanged_T_Camera, camVo.Id, protomsg.DbAction_Update, "")
      _, _ = service2.DoBusReq("/data/api-v/saas/syncCamera", config.Server.AnalyServerId, aiot.RequestMethod_Post, aiot.RequestContentType_ApplicationJson, map[string]interface{}{})
      return &bhomeclient.Reply{Success: true, Data: camVo.Copy2Camera()}
@@ -109,6 +129,13 @@
   if cid == "" {
      return &bhomeclient.Reply{Msg: "参数有误,摄像机id不能为空"}
   }
   //判断是否有配置任务
   total, _ := models.GetTaskTotal(cid)
   if total > 0 {
      return &bhomeclient.Reply{Success: false, Msg: "请先删除配置的任务"}
   }
   rows, _ := cam.Delete(cid)
   if rows == 0 {
      return &bhomeclient.Reply{Success: true, Msg: "记录不存在"}
@@ -1139,6 +1166,9 @@
         Content:         v.CameraName,
         PicDate:         v.PicDate,
         LikeDate:        v.LikeDate,
         VideoName:       v.CameraName,
         CameraAddr:      v.CameraName,
         CameraName:      v.CameraName,
      }
      //任务名称
@@ -1146,9 +1176,9 @@
      temp.TaskNames = items
      //视频内容
      items4, _ := models.GetVideoById(v.VideoPointId)
      temp.VideoName = items4.Name
      temp.CameraAddr = items4.Addr
      // items4, _ := models.GetVideoById(v.VideoPointId)
      // temp.VideoName = items4.Name
      // temp.CameraAddr = items4.Addr
      //检查内容
      items2, _ := models.GetCheckByIds(v.DetectId)