mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Feat: zip create
This commit is contained in:
@@ -22,13 +22,16 @@ 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))
|
||||
var service = explorer.ItemService{
|
||||
Items: []uint{117, 118, 119, 120, 121, 122, 123},
|
||||
Dirs: []uint{},
|
||||
}
|
||||
//if err := c.ShouldBindJSON(&service); err == nil {
|
||||
_ = service.ArchiveAndDownload(ctx, c)
|
||||
//c.JSON(200, res)
|
||||
//} else {
|
||||
// c.JSON(200, ErrorResponse(err))
|
||||
//}
|
||||
}
|
||||
|
||||
// AnonymousGetContent 匿名获取文件资源
|
||||
|
||||
@@ -102,7 +102,7 @@ func InitRouter() *gin.Engine {
|
||||
// 取得文件外链
|
||||
file.GET("source/:id", controllers.GetSource)
|
||||
// 测试用:压缩文件和目录并下載
|
||||
file.POST("archive", controllers.ArchiveAndDownload)
|
||||
file.GET("archive", controllers.ArchiveAndDownload)
|
||||
}
|
||||
|
||||
// 目录
|
||||
|
||||
Reference in New Issue
Block a user