liuxiaolong
2019-12-13 6039aa226412c1ffbd78460a4ca623873a177f74
controllers/syssetcont.go
@@ -34,14 +34,10 @@
   RealMax            int    `json:"real_max"` //实时处理的最大路数
}
type ServerConfigSaveVo struct {
   ServiceIpType       int      `json:"serviceIpType"` //0:本机ip,1:漂移ip
   ServiceIp           string    `json:"serviceIp"`  //外部服务ip
   Domain             string  `json:"domain"` //域名
   ImgPort          int     `json:"imgPort"` //图片端口
   VideoPort           int    `json:"videoPort"`  //视频端口
   AudioPort           int     `json:"audioPort"`  //音频端口
type ResourceConfigVo struct {
   IpType       int      `json:"ipType"` //0:本机ip,1:漂移ip
   ServiceIp   string    `json:"serviceIp"`  //外部服务ip
   Domain       string  `json:"domain"` //域名
}
type Gb28181ConfigVo struct {
@@ -62,21 +58,6 @@
   Interval  int    `json:"interval" example:"自动校时间隔"`
   NewTime   string `json:"newTime" example:"手动指定时间"`
}
/*
// @Security ApiKeyAuth
// @Summary 保存对外服务ip、录像时长以及音视频端口
// @Description 保存对外服务ip、录像时长以及音视频端口
// @Accept  json
// @Produce json
// @Tags sysset
// @Param config body controllers.ServerConfigSaveVo true "参数"
// @Success 200 {string} json "{"code":200, msg:"", success:true}"
// @Failure 500 {string} json "{"code":500, msg:"", success:false}"
// @Router /data/api-v/sysset/saveConfig [POST]
func (sset SysSetController) SaveConfig(c *gin.Context) {
}*/
// @Security ApiKeyAuth
// @Summary 存储信息查询
@@ -457,3 +438,47 @@
   util.ResponseFormat(c, code.Success, "配置成功")
}
// @Security ApiKeyAuth
// @Summary 获取存储对外服务信息
// @Description 获取存储对外服务信息
// @Produce json
// @Tags sysset
// @Success 200 {string} json "{"code":200, msg:"", success:true}"
// @Failure 500 {string} json "{"code":500, msg:"", success:false}"
// @Router /data/api-v/sysset/getResourceConfig [get]
func (sset SysSetController) GetResourceConfig(c *gin.Context) {
   var sysApi dbapi.SysSetApi
   b,d := sysApi.GetResourceConfig()
   if b {
      util.ResponseFormat(c,code.Success,d)
   } else {
      util.ResponseFormat(c,code.ComError,"")
   }
}
// @Security ApiKeyAuth
// @Summary 存储对外服务信息
// @Description 存储对外服务信息
// @Accept  json
// @Produce json
// @Tags sysset
// @Param reqBoby body controllers.ResourceConfigVo true "post请求,json参数"
// @Success 200 {string} json "{"code":200, msg:"", success:true}"
// @Failure 500 {string} json "{"code":500, msg:"", success:false}"
// @Router /data/api-v/sysset/saveResourceConfig [post]
func (sset SysSetController) SaveResourceConfig(c *gin.Context) {
   var reqBody ResourceConfigVo
   c.BindJSON(&reqBody)
   if reqBody.ServiceIp == "" && reqBody.Domain == "" {
      util.ResponseFormat(c,code.RequestParamError,"")
      return
   }
   var sysApi dbapi.SysSetApi
   paramBody := util.Struct2Map(reqBody)
   if b,_ := sysApi.SaveResourceConfig(paramBody); b {
      util.ResponseFormat(c,code.Success,"")
   } else {
      util.ResponseFormat(c,code.ComError,"")
   }
}