From 7c811247ecf143e08c576986a884bedadc57dd66 Mon Sep 17 00:00:00 2001 From: liuxiaolong <liuxiaolong@aiotlink.com> Date: 星期五, 05 六月 2020 18:29:41 +0800 Subject: [PATCH] add refresh token to resp --- controllers/pollConfig.go | 40 ++++++++++++++++++++++++++++++++++++++-- 1 files changed, 38 insertions(+), 2 deletions(-) diff --git a/controllers/pollConfig.go b/controllers/pollConfig.go index 9362d88..b676b8f 100644 --- a/controllers/pollConfig.go +++ b/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, "鏌ヨ澶辫触") } @@ -113,3 +119,33 @@ util.ResponseFormat(c, code.ComError, "淇敼澶辫触") } } + +type ChannelCountSet struct { + PollChannelCount int `json:"pollChannelCount"` + VideoChannelCount int `json:"videoChannelCount"` +} + +// @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 + err := c.BindJSON(&argBody) + if err != nil { + util.ResponseFormat(c, code.RequestParamError, "鍙傛暟鏈夎") + return + } + var api dbapi.SysSetApi + if api.UpdateChannelCount(argBody.PollChannelCount, argBody.VideoChannelCount) { + util.ResponseFormat(c,code.UpdateSuccess,"鏇存柊鎴愬姛") + } else { + util.ResponseFormat(c,code.UpdateFail,"鏇存柊澶辫触") + } +} \ No newline at end of file -- Gitblit v1.8.0