liuxiaolong
2020-02-28 de48b4f9173d5e7493500a2036554c41a733eee0
add findByStackId
2个文件已修改
29 ■■■■■ 已修改文件
controllers/fileAnalysis.go 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
router/router.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/fileAnalysis.go
@@ -142,3 +142,31 @@
    }
}
// @Param stackId string query true "stackId"
// @Param type int query true "type"
// @Param page query int true "当前页"
// @Param size query int true "每页数量"
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"))
    if page <= 0 {
        page = 1
    }
    if size <= 0 {
        size = 20
    }
    var api dbapi.FileAnalysisApi
    arr,err := api.FindByStackId(stackId, typ, page, size)
    if err !=nil {
        util.ResponseFormat(c,code.ComError, "")
    } else {
        util.ResponseFormat(c,code.Success, arr)
    }
}
router/router.go
@@ -324,6 +324,7 @@
        fileAnalyApi.POST("/updateStatus", fileAnalysisC.UpdateStatus)
        fileAnalyApi.POST("/delete", fileAnalysisC.Delete)
        fileAnalyApi.POST("/sortFile", fileAnalysisC.SortFile)
        fileAnalyApi.GET("/findByStackId", fileAnalysisC.FindByStackId)
    }
    fileSettingApi := r.Group(urlPrefix + "/fileSetting")
    {