From b0500fee9c01e17c81b9293b244c8ed88dc9ca29 Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期五, 11 十月 2019 15:12:25 +0800 Subject: [PATCH] add swagger --- controllers/camera.go | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/controllers/camera.go b/controllers/camera.go index 7e484ef..8cf4d24 100644 --- a/controllers/camera.go +++ b/controllers/camera.go @@ -5,6 +5,7 @@ "fmt" "strconv" "basic.com/valib/logger.git" + "webserver/cache" "github.com/gin-gonic/gin" @@ -197,6 +198,32 @@ fmt.Println(areaId) } +// @Summary 鏍规嵁server鑾峰彇鎵�鏈夋憚鍍忔満鍒楄〃鍙婁俊鎭� +// @Description 鏍规嵁server鑾峰彇鎵�鏈夋憚鍍忔満鍒楄〃鍙婁俊鎭� +// @Security ApiKeyAuth +// @Produce json +// @Tags camera +// @Param cameraName query string false "鎽勫儚鏈哄悕绉�" +// @Success 200 {string} json "{"code":200, success:true, msg:"", data:""}" +// @Failure 500 {string} json "{"code":500, success:false, msg:"",data:""}" +// @Router /data/api-v/camera/getAllCamerasByServer [get] +func (cc CameraController) GetAllCamerasByServer(c *gin.Context) { + localConf, err2 := cache.GetServerInfo() + if err2 !=nil || localConf.ServerId == "" { + logger.Debug("localConfig is wrong!!!") + util.ResponseFormat(c,code.ComError,"鏈嶅姟鍣ㄦ湰鏈烘湭閰嶇疆serverId") + return + } + var api dbapi.CameraApi + cameraName := c.Query("cameraName") + b,d := api.GetAllCamerasByServer(localConf.ServerId, cameraName) + if b { + util.ResponseFormat(c,code.Success, d) + } else { + util.ResponseFormat(c,code.ComError, "") + } +} + // @Summary 鑾峰彇杩愯绫诲瀷鑾峰彇鎽勫儚鏈哄垪琛� // @Description 鑾峰彇杩愯绫诲瀷鑾峰彇鎽勫儚鏈哄垪琛� // @Produce json -- Gitblit v1.8.0