From d8bc4b887afd2b35180e036fe786d527f3bb58ec Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期三, 04 十二月 2019 17:18:20 +0800 Subject: [PATCH] fix UpdateChannelCount --- controllers/pollConfig.go | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/controllers/pollConfig.go b/controllers/pollConfig.go index ffc3258..840b22c 100644 --- a/controllers/pollConfig.go +++ b/controllers/pollConfig.go @@ -93,7 +93,7 @@ } type PollEnableVo struct { - Enable bool `json:"enable"` + Enable bool `json:"enable" binding:"required"` } // @Security ApiKeyAuth @@ -121,8 +121,8 @@ } type ChannelCountSet struct { - PollChannelCount int `json:"pollChannelCount"` - FileChannelCount int `json:"fileChannelCount"` + PollChannelCount int `json:"pollChannelCount" binding:"required"` + VideoChannelCount int `json:"videoChannelCount" binding:"required"` } // @Security ApiKeyAuth @@ -137,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,"鏇存柊澶辫触") -- Gitblit v1.8.0