feat: 增加文件下载功能

This commit is contained in:
zhengkunwang223
2022-09-05 16:25:26 +08:00
parent 04db6a8cf3
commit 16b9adfefe
14 changed files with 195 additions and 5 deletions

View File

@@ -167,3 +167,16 @@ func (b *BaseApi) ChangeName(c *gin.Context) {
}
helper.SuccessWithData(c, nil)
}
func (b *BaseApi) Download(c *gin.Context) {
var req dto.FileDownload
if err := c.ShouldBindJSON(&req); err != nil {
helper.ErrorWithDetail(c, constant.CodeErrBadRequest, constant.ErrTypeInvalidParams, err)
return
}
if err := fileService.Download(req); err != nil {
helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err)
return
}
helper.SuccessWithData(c, nil)
}