Feat: group options in database scheme

This commit is contained in:
HFO4
2019-12-12 09:16:24 +08:00
parent 2b25b9d315
commit ba34a092d1
4 changed files with 55 additions and 6 deletions

View File

@@ -17,6 +17,20 @@ import (
"strconv"
)
func ArchiveAndDownload(c *gin.Context) {
// 创建上下文
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
var service explorer.ItemService
if err := c.ShouldBindJSON(&service); err == nil {
res := service.ArchiveAndDownload(ctx, c)
c.JSON(200, res)
} else {
c.JSON(200, ErrorResponse(err))
}
}
// AnonymousGetContent 匿名获取文件资源
func AnonymousGetContent(c *gin.Context) {
// 创建上下文

View File

@@ -101,6 +101,8 @@ func InitRouter() *gin.Engine {
file.GET("thumb/:id", controllers.Thumb)
// 取得文件外链
file.GET("source/:id", controllers.GetSource)
// 测试用:压缩文件和目录并下載
file.POST("archive", controllers.ArchiveAndDownload)
}
// 目录