Feat: download temporary archive file

This commit is contained in:
HFO4
2019-12-13 15:10:44 +08:00
parent afc0b647ca
commit 02c93be3bc
6 changed files with 103 additions and 15 deletions

View File

@@ -17,7 +17,23 @@ import (
"strconv"
)
func ArchiveAndDownload(c *gin.Context) {
func DownloadArchive(c *gin.Context) {
// 创建上下文
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
var service explorer.ArchiveDownloadService
if err := c.ShouldBindUri(&service); err == nil {
res := service.Download(ctx, c)
if res.Code != 0 {
c.JSON(200, res)
}
} else {
c.JSON(200, ErrorResponse(err))
}
}
func Archive(c *gin.Context) {
// 创建上下文
ctx, cancel := context.WithCancel(context.Background())
defer cancel()