sunty
2019-08-22 a527225f7f3cc93882aa870c20f0985d07d6fe92
controllers/syssetcont.go
@@ -4,6 +4,7 @@
   "basic.com/dbapi.git"
   "github.com/gin-gonic/gin"
   "webserver/extend/code"
   "webserver/extend/config"
   "webserver/extend/util"
)
@@ -15,6 +16,8 @@
   Id string  `json:"id"`
   AlarmIp string `json:"alarm_ip,omitempty" example:"192.168.1.182"`
   AlarmPort int `json:"alarm_port,omitempty" example:"22122"`
   AlarmThresholdType int `json:"alarm_threshold_type"`//报警阈值类型设置:1:按最高分,2:按阈值以上
   AlarmThreshold int `json:"alarm_threshold"`//报警阈值
   WebPicIp string `json:"web_pic_ip,omitempty" example:""`
   WebPicPort int `json:"web_pic_port,omitempty" example:"22122"`
   EsPicIp string `json:"es_pic_ip,omitempty" example:""`
@@ -29,18 +32,18 @@
}
type Gb28181ConfigVo struct {
   Id string `json:"Id" gorm:"primary_key" `
   ServerIp string `json:"ServerIp" example:"国标服务器IP" gorm:"column:ServerIp"`
   ServerPort int `json:"ServerPort" example:"服务器端口:8060" gorm:"column:ServerPort"`
   PublicId string `json:"ServerId" example:"国标服务器Id" gorm:"column:PublicId"`
   GbServerPort int `json:"GbServerPort" example:"国标服务端口:7060" gorm:"column:GbServerPort"`
   IsAuth bool `json:"IsAuth" example:"是否开启鉴权:true" gorm:"column:IsAuth"`
   Password string `json:"Password" example:"密码" gorm:"column:Password"`
   UpdateTime string `json:"UpdateTime" gorm:"column:UpdateTime"`
   Id string `json:"Id"`
   ServerIp string `json:"ServerIp" example:"国标服务器IP"`
   ServerPort int `json:"ServerPort" example:"服务器端口:8060"`
   PublicId string `json:"PublicId" example:"国标服务器Id"`
   GbServerPort int `json:"GbServerPort" example:"国标服务端口:7060"`
   IsAuth bool `json:"IsAuth" example:"是否开启鉴权:true"`
   Password string `json:"Password" example:"密码"`
   UpdateTime string `json:"UpdateTime"`
}
// @Summary 存储信息查询
// @Description 存储信息查询
// @Summary 基础设置查询
// @Description 基础设置查询
// @Accept  json
// @Produce json
// @Tags sysset
@@ -57,8 +60,8 @@
   }
}
// @Summary 存储信息修改
// @Description 存储信息修改
// @Summary 报警设置修改
// @Description 报警设置修改
// @Accept  json
// @Produce json
// @Tags sysset
@@ -83,8 +86,8 @@
   }
}
// @Summary 存储信息修改
// @Description 存储信息修改
// @Summary 报警时长修改
// @Description 报警时长修改
// @Accept  json
// @Produce json
// @Tags sysset
@@ -145,8 +148,13 @@
   if !b { // 查询是否存在
      util.ResponseFormat(c, code.ServiceInsideError,"查询失败")
   }else {
      resData["dev_id"] = sysconf.GetServerId()
      resData["dev_name"] = sysconf.GetServerName()
      resData["server_id"] = sysconf.GetServerId()
      resData["server_name"] = sysconf.GetServerName()
      ipv4, mask, _ := util.GetLocalIP(config.Server.NetworkAdapter)
      gateway, _ := util.GetDefaultRoute(config.Server.NetworkAdapter)
      resData["ip"] = ipv4
      resData["subMask"] = mask
      resData["gateway"] = gateway
      // 存在
      util.ResponseFormat(c, code.Success, resData)
   }
@@ -164,7 +172,7 @@
// @Router /data/api-v/sysset/saveDevInfo [POST]
func (sset SysSetController) SaveDevInfo(c *gin.Context){
   dev_name := c.Request.FormValue("dev_name")
   dev_name := c.PostForm("server_name")
   var api dbapi.SysSetApi
   paramBody :=make(map[string]interface{},0)
   paramBody["serverName"] = dev_name