Feat: download file from single file share

This commit is contained in:
HFO4
2020-01-28 12:41:00 +08:00
parent 0977b36f8b
commit 7f0feebf42
13 changed files with 199 additions and 8 deletions

View File

@@ -26,3 +26,14 @@ func GetShare(c *gin.Context) {
c.JSON(200, ErrorResponse(err))
}
}
// GetShareDownload 创建分享下载会话
func GetShareDownload(c *gin.Context) {
var service share.SingleFileService
if err := c.ShouldBindQuery(&service); err == nil {
res := service.CreateDownloadSession(c)
c.JSON(200, res)
} else {
c.JSON(200, ErrorResponse(err))
}
}

View File

@@ -172,6 +172,8 @@ func InitMasterRouter() *gin.Engine {
{
// 获取分享
share.GET(":id", controllers.GetShare)
// 创建文件下载会话
share.POST("download/:id", controllers.GetShareDownload)
}
// 需要登录保护的