Feat: custom error for general layer codes

This commit is contained in:
HFO4
2019-11-26 19:51:54 +08:00
parent 9a1665526c
commit a734493b65
5 changed files with 89 additions and 0 deletions

View File

@@ -7,11 +7,27 @@ import (
"github.com/HFO4/cloudreve/pkg/filesystem/local"
"github.com/HFO4/cloudreve/pkg/serializer"
"github.com/HFO4/cloudreve/pkg/util"
"github.com/HFO4/cloudreve/service/explorer"
"github.com/gin-gonic/gin"
"net/url"
"strconv"
)
// Download 文件下载
func Download(c *gin.Context) {
// 创建上下文
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
var service explorer.FileDownloadService
if err := c.ShouldBindQuery(&service); err == nil {
res := service.Download(ctx, c)
c.JSON(200, res)
} else {
c.JSON(200, ErrorResponse(err))
}
}
// FileUploadStream 本地策略流式上传
func FileUploadStream(c *gin.Context) {
// 创建上下文