liuxiaolong
2019-12-04 b9cfbd535a56710b45bf99d46d0cf1a0a31a6f5b
controllers/pollConfig.go
@@ -13,16 +13,17 @@
type PollConfig struct {
   ServerId   string `json:"server_id"`   //服务器id
   PollPeriod int    `json:"poll_period"` //轮询周期
   Delay      int    `json:"delay"`       //延时时间
   PollPeriod int32    `json:"poll_period"` //轮询周期
   Delay      int32    `json:"delay"`       //延时时间
   Enable     bool   `json:"enable"`      //是否启用轮询
}
// @Security ApiKeyAuth
// @Summary 保存轮询周期
// @Description 保存轮询周期
// @Produce json
// @Tags 轮询配置
// @Param period query int true "轮询周期"
// @Param period formData int true "轮询周期"
// @Success 200 {string} json "{"code":200, success:true, msg:"", data:""}"
// @Failure 500 {string} json "{"code":500, success:false, msg:"",data:""}"
// @Router /data/api-v/pollConfig/savePollPeriod [post]
@@ -42,11 +43,12 @@
   }
}
// @Security ApiKeyAuth
// @Summary 保存轮询延时
// @Description 保存轮询延时
// @Produce json
// @Tags 轮询配置
// @Param delay query int true "轮询延时时间"
// @Param delay formData int true "轮询延时时间"
// @Success 200 {string} json "{"code":200, success:true, msg:"", data:""}"
// @Failure 500 {string} json "{"code":500, success:false, msg:"",data:""}"
// @Router /data/api-v/pollConfig/savePollDelay [post]
@@ -66,6 +68,7 @@
   }
}
// @Security ApiKeyAuth
// @Summary 获取本机轮询配置
// @Description 获取本机轮询配置
// @Produce json
@@ -87,8 +90,10 @@
   Enable bool `json:"enable"`
}
// @Security ApiKeyAuth
// @Summary 切换轮询开关
// @Description 切换轮询开关
// @Accept json
// @Produce json
// @Tags 轮询配置
// @Param argBody body controllers.PollEnableVo true "开关参数"
@@ -108,3 +113,29 @@
      util.ResponseFormat(c, code.ComError, "修改失败")
   }
}
type ChannelCountSet struct {
   PollChannelCount int `json:"pollChannelCount"`
   FileChannelCount int `json:"fileChannelCount"`
}
// @Security ApiKeyAuth
// @Summary 设置轮询算力和本地算力的数量
// @Description 设置轮询算力和本地算力的数量
// @Accept json
// @Produce json
// @Tags 轮询配置
// @Param argBody body controllers.ChannelCountSet true "轮询通道数量以及本地通道数量"
// @Success 200 {string} json "{"code":200, success:true, msg:"", data:""}"
// @Failure 500 {string} json "{"code":500, success:false, msg:"",data:""}"
// @Router /data/api-v/pollConfig/updateChannelCount [post]
func (controller PollConfigController) UpdateChannelCount(c *gin.Context) {
   var argBody ChannelCountSet
   c.BindJSON(&argBody)
   var api dbapi.SysSetApi
   if api.UpdateChannelCount(argBody.PollChannelCount, argBody.FileChannelCount) {
      util.ResponseFormat(c,code.UpdateSuccess,"更新成功")
   } else {
      util.ResponseFormat(c,code.UpdateFail,"更新失败")
   }
}