From d32751ea5d4ef1e444fb3c59a4b39de9952dd0c0 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Wed, 16 Jun 2021 18:34:51 +0800 Subject: [PATCH] =?UTF-8?q?refactor=F0=9F=8E=A8=EF=BC=9A=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=BF=AE=E6=94=B9=E4=B8=BA=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/other/apis/file.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/app/other/apis/file.go b/app/other/apis/file.go index 9f47d30..0aadb12 100644 --- a/app/other/apis/file.go +++ b/app/other/apis/file.go @@ -101,8 +101,8 @@ func (e File) baseImg(c *gin.Context, fileResponse FileResponse, urlPerfix strin return fileResponse } if source != "1" { - fileResponse.Path = "https://youshikeji.oss-cn-shanghai.aliyuncs.com/img/" + fileName - fileResponse.FullPath = "https://youshikeji.oss-cn-shanghai.aliyuncs.com/img/" + fileName + fileResponse.Path = "/static/uploadfile/" + fileName + fileResponse.FullPath = "/static/uploadfile/" + fileName } return fileResponse } @@ -135,8 +135,8 @@ func (e File) multipleFile(c *gin.Context, urlPerfix string) []FileResponse { Type: fileType, } if source != "1" { - fileResponse.Path = "https://youshikeji.oss-cn-shanghai.aliyuncs.com/img/" + fileName - fileResponse.FullPath = "https://youshikeji.oss-cn-shanghai.aliyuncs.com/img/" + fileName + fileResponse.Path = "/static/uploadfile/" + fileName + fileResponse.FullPath = "/static/uploadfile/" + fileName } multipartFile = append(multipartFile, fileResponse) } @@ -171,14 +171,14 @@ func (e File) singleFile(c *gin.Context, fileResponse FileResponse, urlPerfix st Name: files.Filename, Type: fileType, } - source, _ := c.GetPostForm("source") - err = thirdUpload(source, fileName, singleFile) - if err != nil { - e.Error(200, errors.New(""), "上传第三方失败") - return FileResponse{}, true - } - fileResponse.Path = "https://youshikeji.oss-cn-shanghai.aliyuncs.com/img/" + fileName - fileResponse.FullPath = "https://youshikeji.oss-cn-shanghai.aliyuncs.com/img/" + fileName + //source, _ := c.GetPostForm("source") + //err = thirdUpload(source, fileName, singleFile) + //if err != nil { + // e.Error(200, errors.New(""), "上传第三方失败") + // return FileResponse{}, true + //} + fileResponse.Path = "/static/uploadfile/" + fileName + fileResponse.FullPath = "/static/uploadfile/" + fileName return fileResponse, false } @@ -200,4 +200,4 @@ func ossUpload(name string, path string) error { func qiniuUpload(name string, path string) error { oss := file_store.ALiYunOSS{} return oss.UpLoad(name, path) -} +} \ No newline at end of file