liuxiaolong
2019-09-28 4c7890a506f95bfc8d06a75dbf6150bb8fcad1bb
controllers/syssetcont.go
@@ -3,8 +3,8 @@
import (
   "basic.com/dbapi.git"
   "github.com/gin-gonic/gin"
   "time"
   "webserver/extend/code"
   "webserver/extend/config"
   "webserver/extend/util"
)
@@ -16,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:""`
@@ -30,13 +32,14 @@
}
type Gb28181ConfigVo struct {
   ID int `json:"ID,omitempty" gorm:"primary_key" `
   ServerIp string `json:"ServerIp,omitempty" example:"SIP服务器IP" gorm:"column:ServerIp"`
   ServerPort int `json:"ServerPort,omitempty" example:"21231" gorm:"column:ServerPort"`
   ServerId string `json:"ServerId,omitempty" example:"SIP服务器Id" gorm:"column:ServerId"`
   UserAuthId string `json:"UserAuthId,omitempty" example:"SIP用户认证ID" gorm:"column:UserAuthId"`
   Password string `json:"Password,omitempty" example:"密码" gorm:"column:Password"`
   UpdateTime time.Time `json:"-" gorm:"column:UpdateTime"`
   Id string `json:"Id"`
   ServerIp string `json:"ServerIp" example:"国标服务器IP"`
   ServerPort int `json:"ServerPort" example:"平台服务端口:7060"`
   PublicId string `json:"PublicId" example:"平台服务Id"`
   GbServerPort int `json:"GbServerPort" example:"国标服务端口:8060"`
   IsAuth bool `json:"IsAuth" example:"是否开启鉴权:true"`
   Password string `json:"Password" example:"密码"`
   UpdateTime string `json:"UpdateTime"`
}
// @Summary 存储信息查询
@@ -145,9 +148,22 @@
   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
      resData["deviceNum"] = config.Server.DeviceNum
      resData["deviceType"] = config.Server.DeviceType
      resData["deviceSerialNum"] = config.Server.DeviceSerialNum
      resData["masterVersion"] = config.Server.MasterVersion
      resData["webVersion"] = config.Server.WebVersion
      resData["channelCount"] = config.Server.ChannelCount
      resData["diskCount"] = config.Server.DiskCount
      util.ResponseFormat(c, code.Success, resData)
   }
}
@@ -164,7 +180,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
@@ -205,7 +221,7 @@
// @Failure 500 {string} json "{"code":500,  msg:"返回错误信息", success:false}"
// @Router /data/api-v/sysset/gb28181ConfigEdit [POST]
func (sset SysSetController) Gb28181ConfigEdit(c *gin.Context) {
   var args LocalConfigVo
   var args Gb28181ConfigVo
   err := c.BindJSON(&args)
   if err !=nil {
      util.ResponseFormat(c,code.RequestParamError,"参数有误")