sunty
2020-08-20 9d88c7c467f8d93af4aab9ba0b6d6c01c2ffc546
controllers/camera.go
@@ -45,6 +45,9 @@
   ResolutionHeight int   `json:"resolution_height"`//分辨率高
   Sensors []SensorVo `json:"sensors"` //传感器列表
   VoiceEnable       bool                   `json:"voiceEnable"`
   VoiceId          string                   `json:"voiceId"`
}
type Resolution struct {
@@ -54,14 +57,13 @@
type SensorVo struct {
   Id        string       `json:"id"`
   Type      int          `json:"type"`
   Type      string       `json:"type"`
   Ip         string       `json:"ip"`
   Port      int          `json:"port"`
   Username  string       `json:"username"`
   Password  string       `json:"password"`
   Threshold int          `json:"threshold"`
   Enable      bool          `json:"enable"`
   DevId       string       `json:"devId"`
}
// @Summary 添加摄像机
@@ -113,6 +115,7 @@
      util.ResponseFormat(c, code.RequestParamError, "参数错误")
      return
   }
   logger.Debug("camera sensors:", cam.Sensors)
   paramBody := util.Struct2Map(cam)
   if api.CameraUpdate(paramBody) {
      util.ResponseFormat(c, code.Success, cam)
@@ -162,12 +165,24 @@
   //2019-11-02新增需求,显示每个摄像机的处理服务器信息,归属的节点服务器名称
   m := util.Struct2Map(camera)
   m["runServerName"] = ""
   m["voiceEnable"] = camera.VoiceEnable
   m["voiceId"] = camera.VoiceId
   m["resolution_width"] = camera.ResolutionWidth
   m["resolution_height"] = camera.ResolutionHeight
   //摄像机分辨率
   dResolution := Resolution{
   dRe0 := Resolution{
      Width: 0,
      Height: 0,
   }
   m["resolutions"] = []Resolution{ dResolution }
   dRe1 := Resolution{
      Width: 1920,
      Height: 1080,
   }
   dRe2 := Resolution{
      Width: 2688,
      Height: 1520,
   }
   m["resolutions"] = []Resolution{ dRe0, dRe1, dRe2 }
   if camera.RunServerId !="" {
      localConf, e := cache.GetServerInfo()
      if e ==nil {