From ecf240e29e0ee8046db32ba1e63cf714155c2e1a Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期一, 02 三月 2020 17:42:53 +0800 Subject: [PATCH] fix result --- controllers/fileAnalysis.go | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 42 insertions(+), 1 deletions(-) diff --git a/controllers/fileAnalysis.go b/controllers/fileAnalysis.go index 29d6807..5c36331 100644 --- a/controllers/fileAnalysis.go +++ b/controllers/fileAnalysis.go @@ -20,6 +20,7 @@ // @Param fileName query string false "鏍规嵁鏂囦欢鍚嶇О鏌ヨ" // @Param page query int true "褰撳墠椤�" // @Param size query int true "姣忛〉鏁伴噺" +// @Param type query int true "0:澶勭悊瀹屾垚锛�1:澶勭悊涓紝2:鏈厤瑙勫垯锛�3:澶勭悊澶辫触" // @Success 200 {string} json "{"code":200, success:true, msg:"", data:""}" // @Failure 500 {string} json "{"code":500, success:false, msg:"",data:""}" // @Router /data/api-v/fileAnalysis/findAllFile [get] @@ -27,8 +28,9 @@ fileName := c.Query("fileName") page,_ := strconv.Atoi(c.Query("page")) size,_ := strconv.Atoi(c.Query("size")) + fType,_ := strconv.Atoi(c.Query("type")) var api dbapi.FileAnalysisApi - b, d := api.FindAllFile(fileName, page, size) + b, d := api.FindAllFile(fileName, fType, page, size) if b { util.ResponseFormat(c,code.Success, d) } else { @@ -140,3 +142,42 @@ } } + +// @Security ApiKeyAuth +// @Summary 鎸夋暟鎹爤id鏌ユ壘鏂囦欢 +// @Description 鎸夋暟鎹爤id鏌ユ壘鏂囦欢 +// @Accept json +// @Produce json +// @Tags 鏈湴鏂囦欢 +// @Param stackId query string true "stackId" +// @Param type query int true "type" +// @Param name query string "鎼滅储鏉′欢" +// @Param page query int true "褰撳墠椤�" +// @Param size query int 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/fileAnalysis/findByStackId [get] +func (fac FileAnalysisController) FindByStackId(c *gin.Context) { + stackId := c.Query("stackId") + if stackId == "" { + util.ResponseFormat(c,code.RequestParamError, "") + return + } + typ,_ := strconv.Atoi(c.Query("type")) + page,_ := strconv.Atoi(c.Query("page")) + size,_ := strconv.Atoi(c.Query("size")) + name := c.Query("name") + if page <= 0 { + page = 1 + } + if size <= 0 { + size = 20 + } + var api dbapi.FileAnalysisApi + b,d := api.FindByStackId(stackId, typ, name, page, size) + if !b { + util.ResponseFormat(c,code.ComError, "") + } else { + util.ResponseFormat(c,code.Success, d) + } +} -- Gitblit v1.8.0