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 --- go.sum | 8 ++++---- controllers/pollConfig.go | 14 +++++++++----- go.mod | 4 ++-- 3 files changed, 15 insertions(+), 11 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,"鏇存柊澶辫触") diff --git a/go.mod b/go.mod index 5f06614..1a648eb 100644 --- a/go.mod +++ b/go.mod @@ -3,12 +3,12 @@ go 1.12 require ( - basic.com/dbapi.git v0.0.0-20191204054247-0213e81df2bc // indirect + basic.com/dbapi.git v0.0.0-20191204083757-c9635ae13e45 // indirect basic.com/fileServer/WeedFSClient.git v0.0.0-20190919054037-0182b6c3f5cb // indirect basic.com/gb28181api.git v0.0.0-20191028082253-472438a8407b // indirect basic.com/pubsub/cache.git v0.0.0-20190718093725-6a413e1d7d48 // indirect basic.com/pubsub/esutil.git v0.0.0-20191120125514-865efa73a9ae // indirect - basic.com/pubsub/protomsg.git v0.0.0-20191204052447-abd6d2381b39 // indirect + basic.com/pubsub/protomsg.git v0.0.0-20191204083653-a32445f65a09 // indirect basic.com/valib/capture.git v0.0.0-20191126081138-bf954c0fa627 // indirect basic.com/valib/deliver.git v0.0.0-20190531095353-25d8c3b20051 basic.com/valib/godraw.git v0.0.0-20191122082247-26e9987cd183 // indirect diff --git a/go.sum b/go.sum index befff34..9c5194a 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -basic.com/dbapi.git v0.0.0-20191204054247-0213e81df2bc h1:tt0UHaoU7MSsLwZDkHa+YXa798gxHysASIJl35aoWFg= -basic.com/dbapi.git v0.0.0-20191204054247-0213e81df2bc/go.mod h1:eDXPnxaz6jZPDvBSk7ya7oSASWPCuUEgRTJCjsfKt/Q= +basic.com/dbapi.git v0.0.0-20191204083757-c9635ae13e45 h1:BCB7ieRjfAiSyfLImqo37FvJ9iV11gFuz6qAHUw2JfM= +basic.com/dbapi.git v0.0.0-20191204083757-c9635ae13e45/go.mod h1:eDXPnxaz6jZPDvBSk7ya7oSASWPCuUEgRTJCjsfKt/Q= basic.com/fileServer/WeedFSClient.git v0.0.0-20190919054037-0182b6c3f5cb h1:fM6DojeInFSCFO+wkba1jtyPiSDqw0jYKi4Tk+e+ka4= basic.com/fileServer/WeedFSClient.git v0.0.0-20190919054037-0182b6c3f5cb/go.mod h1:FTryK8BsVLfUplx8a3+l8hJWub6VbAWZCUH7sPRZaso= basic.com/gb28181api.git v0.0.0-20191028082253-472438a8407b h1:Qh7x2PY3HA9B404Llq+olY5/YlGYrM58bpOHa2CGcro= @@ -8,8 +8,8 @@ basic.com/pubsub/cache.git v0.0.0-20190718093725-6a413e1d7d48/go.mod h1:gHLJZz2ee1cGL0X0ae69fs56bAxkDgEQwDhhXZJNUcY= basic.com/pubsub/esutil.git v0.0.0-20191120125514-865efa73a9ae h1:/j1dIDLxzEp51N+ZHZIq1xeYVK9zz8epWEAfw01uWe8= basic.com/pubsub/esutil.git v0.0.0-20191120125514-865efa73a9ae/go.mod h1:yIvppFPFGC61DOdm71ujnsxZBMFUu2yKjr5O43bMWCw= -basic.com/pubsub/protomsg.git v0.0.0-20191204052447-abd6d2381b39 h1:Oq28Qs2tijZOE4FY88+3zs+zPbGE/8pWf/KCPgc0dgk= -basic.com/pubsub/protomsg.git v0.0.0-20191204052447-abd6d2381b39/go.mod h1:un5NV5VWQoblVLZfx1Rt5vyLgwR0jI92d3VJhfrJhWU= +basic.com/pubsub/protomsg.git v0.0.0-20191204083653-a32445f65a09 h1:3Aiyv/In6oJvjUI6jb5N+vt7S4jUqUf+bVEbOKxK6k0= +basic.com/pubsub/protomsg.git v0.0.0-20191204083653-a32445f65a09/go.mod h1:un5NV5VWQoblVLZfx1Rt5vyLgwR0jI92d3VJhfrJhWU= basic.com/valib/capture.git v0.0.0-20191126081138-bf954c0fa627 h1:26J3wU05U/v72SvUvtFc6Ymgvlill9SXbRn/cMGE5k0= basic.com/valib/capture.git v0.0.0-20191126081138-bf954c0fa627/go.mod h1:y+h7VUnoSQ3jOtf2K3twXNA8fYDfyUsifSswcyKLgNw= basic.com/valib/deliver.git v0.0.0-20190531095353-25d8c3b20051/go.mod h1:bkYiTUGzckyNOjAgn9rB/DOjFzwoSHJlruuWQ6hu6IY= -- Gitblit v1.8.0