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/fileAnalysis.go | 91 +++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 86 insertions(+), 5 deletions(-) diff --git a/controllers/fileAnalysis.go b/controllers/fileAnalysis.go index c188726..44a6e84 100644 --- a/controllers/fileAnalysis.go +++ b/controllers/fileAnalysis.go @@ -50,7 +50,7 @@ type FileStatusVo struct { Ids []string `json:"ids" binding:"required"` - Status int `json:"status" binding:"required"` + Status int `json:"status"` } const ( @@ -151,7 +151,7 @@ // @Tags 鏈湴鏂囦欢 // @Param stackId query string true "stackId" // @Param type query int true "type" -// @Param name query string "鎼滅储鏉′欢" +// @Param name query string false "鎼滅储鏉′欢" // @Param page query int true "褰撳墠椤�" // @Param size query int true "姣忛〉鏁伴噺" // @Success 200 {string} json "{"code":200, success:true, msg:"", data:""}" @@ -166,6 +166,7 @@ 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 } @@ -173,10 +174,90 @@ size = 20 } var api dbapi.FileAnalysisApi - arr,err := api.FindByStackId(stackId, typ, page, size) - if err !=nil { + b,d := api.FindByStackId(stackId, typ, name, page, size) + if !b { util.ResponseFormat(c,code.ComError, "") } else { - util.ResponseFormat(c,code.Success, arr) + util.ResponseFormat(c,code.Success, d) + } +} + +// @Summary 閲嶅懡鍚� +// @Description 閲嶅懡鍚� +// @Accept json +// @Produce json +// @Tags 鏈湴鏂囦欢 +// @Param id formData string true "鏂囦欢id" +// @Param name formData string 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/rename [post] +func (fac FileAnalysisController) Rename(c *gin.Context) { + id := c.Request.FormValue("id") + name := c.Request.FormValue("name") + if id == "" || name == "" { + util.ResponseFormat(c,code.RequestParamError,"") + return + } + var api dbapi.FileAnalysisApi + if api.Rename(id, name) { + util.ResponseFormat(c,code.Success, "") + } else { + util.ResponseFormat(c,code.ComError,"") + } +} + +// @Summary 绉诲姩 +// @Description 绉诲姩 +// @Accept json +// @Produce json +// @Tags 鏈湴鏂囦欢 +// @Param id formData string true "鏂囦欢id" +// @Param stackId formData string true "鏁版嵁鏍坕d" +// @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/move [post] +func (fac FileAnalysisController) Move(c *gin.Context) { + id := c.Request.FormValue("id") + stackId := c.Request.FormValue("stackId") + if id == "" || stackId == "" { + util.ResponseFormat(c,code.RequestParamError,"") + return + } + var api dbapi.FileAnalysisApi + if api.Move(id, stackId) { + util.ResponseFormat(c,code.Success, "") + } else { + util.ResponseFormat(c,code.ComError,"") + } +} + +type FileMoveVo struct { + Id string `json:"id" binding:"required"` + StackIds []string `json:"stackIds" binding:"required"` +} + +// @Summary 澶嶅埗 +// @Description 澶嶅埗 +// @Accept json +// @Produce json +// @Tags 鏈湴鏂囦欢 +// @Param reqBody body controllers.FileMoveVo 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/copy [post] +func (fac FileAnalysisController) Copy(c *gin.Context) { + var reqBody FileMoveVo + err := c.BindJSON(&reqBody) + if err != nil { + util.ResponseFormat(c,code.RequestParamError,"") + return + } + + var api dbapi.FileAnalysisApi + if api.Copy(reqBody.Id, reqBody.StackIds) { + util.ResponseFormat(c,code.Success, "") + } else { + util.ResponseFormat(c,code.ComError,"") } } \ No newline at end of file -- Gitblit v1.8.0