From 7103cd719a4a56b3c407b9b3893b85a750ec1a73 Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期一, 09 三月 2020 17:32:41 +0800 Subject: [PATCH] add file mv,sort,copy --- controllers/fileAnalysis.go | 81 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 81 insertions(+), 0 deletions(-) diff --git a/controllers/fileAnalysis.go b/controllers/fileAnalysis.go index 33950b8..298a822 100644 --- a/controllers/fileAnalysis.go +++ b/controllers/fileAnalysis.go @@ -3,6 +3,7 @@ import ( "basic.com/dbapi.git" "github.com/gin-gonic/gin" + "github.com/satori/go.uuid" "strconv" "webserver/extend/code" "webserver/extend/util" @@ -181,3 +182,83 @@ 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