liuxiaolong
2020-06-05 7c811247ecf143e08c576986a884bedadc57dd66
controllers/pollConfig.go
@@ -78,9 +78,15 @@
// @Router /data/api-v/pollConfig/getPollConfig [get]
func (controller PollConfigController) GetPollConfig(c *gin.Context) {
   var api dbapi.SysSetApi
   b, data := api.GetPollConfig()
   b, d := api.GetPollConfig()
   if b {
      util.ResponseFormat(c, code.Success, data)
      util.ResponseFormat(c, code.Success, map[string]interface{}{
         "server_id": d.ServerId,
         "poll_period": d.PollPeriod,
         "delay": d.Delay,
         "enable": d.Enable,
         "pollChannelCount": d.PollChannelCount,
      })
   } else {
      util.ResponseFormat(c, code.ComError, "查询失败")
   }
@@ -116,9 +122,10 @@
type ChannelCountSet struct {
   PollChannelCount int `json:"pollChannelCount"`
   FileChannelCount int `json:"fileChannelCount"`
   VideoChannelCount int `json:"videoChannelCount"`
}
// @Security ApiKeyAuth
// @Summary 设置轮询算力和本地算力的数量
// @Description 设置轮询算力和本地算力的数量
// @Accept json
@@ -130,9 +137,13 @@
// @Router /data/api-v/pollConfig/updateChannelCount [post]
func (controller PollConfigController) UpdateChannelCount(c *gin.Context) {
   var argBody ChannelCountSet
   c.BindJSON(&argBody)
   err := c.BindJSON(&argBody)
   if err != nil {
      util.ResponseFormat(c, code.RequestParamError, "参数有误")
      return
   }
   var api dbapi.SysSetApi
   if api.UpdateChannelCount(argBody.PollChannelCount, argBody.FileChannelCount) {
   if api.UpdateChannelCount(argBody.PollChannelCount, argBody.VideoChannelCount) {
      util.ResponseFormat(c,code.UpdateSuccess,"更新成功")
   } else {
      util.ResponseFormat(c,code.UpdateFail,"更新失败")