qixiaoning
1 天以前 c3fd4effdef0cc5955f89b5df279b14841e857f5
camera-service/controllers/camera.go
@@ -90,6 +90,7 @@
   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{}
@@ -99,6 +100,18 @@
               "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)
         }
         //更新状态
         if cam.IsRunning {
            header := map[string]string{}
            paramBody := map[string]interface{}{
               "state": 1,
            }
            res, err := util.DoPostRequest("http://127.0.0.1:8088/v1/task/updateAllStatus?state=1", util.CONTENT_TYPE_JSON, paramBody, nil, header, time.Second*10)
            if err != nil {
               logger.Debug("DoPostRequest err:", err)
            }
@@ -131,15 +144,24 @@
   }
   //判断是否有配置任务
   total, _ := models.GetTaskTotal(cid)
   if total > 0 {
      return &bhomeclient.Reply{Success: false, Msg: "请先删除配置的任务"}
   }
   // 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: "记录不存在"}
   }
   //删除任务
   items, _ := models.GetTaskTotal(cid)
   if len(items) > 0 {
      for _, item := range items {
         cam.DelLink(item.ID)
      }
   }
   pMsg := protomsg.DbChangeMessage{ //需要重新计算算力占用情况
      Table:  protomsg.TableChanged_T_Camera,
      Action: protomsg.DbAction_Delete,
@@ -1125,9 +1147,9 @@
   if len(TaskName) > 0 {
      quotedNames := make([]string, len(TaskName))
      for i, name := range TaskName {
         quotedNames[i] = "'" + name + "'" // 每个元素加单引号
         quotedNames[i] = " task_name like '%%" + name + "%%' " // 每个元素加单引号
      }
      filter += fmt.Sprintf(" and %s in [%s]", "task_name", strings.Join(quotedNames, ","))
      filter += " and (" + strings.Join(quotedNames, "or") + ")"
   } else {
      if Warning > 0 {
         return &bhomeclient.Reply{Success: true, Msg: "获取成功", Data: nil}