From fea04f12d78452bfc540f4fe5bdf949826db41e2 Mon Sep 17 00:00:00 2001 From: momo <1012651275@qq.com> Date: Mon, 20 Nov 2023 14:48:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=98=BF=E9=87=8C=E4=BA=91OS?= =?UTF-8?q?S=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../internal/logic/uploadfilebackendlogic.go | 16 ++++++++-------- .../upload/internal/logic/uploadfilebaselogic.go | 14 +++++++------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/server/upload/internal/logic/uploadfilebackendlogic.go b/server/upload/internal/logic/uploadfilebackendlogic.go index c5f7168c..b6666545 100644 --- a/server/upload/internal/logic/uploadfilebackendlogic.go +++ b/server/upload/internal/logic/uploadfilebackendlogic.go @@ -109,18 +109,18 @@ func (l *UploadFileBackendLogic) UploadFileBackend(req *types.UploadFileBackendR // 是否备份--异步任务 if req.BackupType != "" { + upload.UploadType = "oss" + upload.AliyunOSS.Endpoint = l.svcCtx.Config.AliyunOSS.Endpoint + upload.AliyunOSS.AccessKeyId = l.svcCtx.Config.AliyunOSS.AccessKeyId + upload.AliyunOSS.AccessKeySecret = l.svcCtx.Config.AliyunOSS.AccessKeySecret + upload.AliyunOSS.BucketName = l.svcCtx.Config.AliyunOSS.BucketName + upload.AliyunOSS.BucketUrl = l.svcCtx.Config.AliyunOSS.BucketUrl + upload.AliyunOSS.BasePath = l.svcCtx.Config.AliyunOSS.BasePath time.AfterFunc(time.Second*1, func() { - upload.UploadType = "oss" - upload.AliyunOSS.Endpoint = l.svcCtx.Config.AliyunOSS.Endpoint - upload.AliyunOSS.AccessKeyId = l.svcCtx.Config.AliyunOSS.AccessKeyId - upload.AliyunOSS.AccessKeySecret = l.svcCtx.Config.AliyunOSS.AccessKeySecret - upload.AliyunOSS.BucketName = l.svcCtx.Config.AliyunOSS.BucketName - upload.AliyunOSS.BucketUrl = l.svcCtx.Config.AliyunOSS.BucketUrl - upload.AliyunOSS.BasePath = l.svcCtx.Config.AliyunOSS.BasePath - err = upload.UploadFileByUrl(resourceId, uploadRes.ResourceUrl) }) } + // 返回成功的响应和上传URL return resp.SetStatus(basic.CodeOK, map[string]interface{}{ "upload_data": UploadUrl{ diff --git a/server/upload/internal/logic/uploadfilebaselogic.go b/server/upload/internal/logic/uploadfilebaselogic.go index 05502299..dd564770 100644 --- a/server/upload/internal/logic/uploadfilebaselogic.go +++ b/server/upload/internal/logic/uploadfilebaselogic.go @@ -91,14 +91,14 @@ func (l *UploadFileBaseLogic) UploadFileBase(req *types.UploadFileBaseReq, useri // 是否备份--异步任务 if req.BackupType != "" { + upload.UploadType = "oss" + upload.AliyunOSS.Endpoint = l.svcCtx.Config.AliyunOSS.Endpoint + upload.AliyunOSS.AccessKeyId = l.svcCtx.Config.AliyunOSS.AccessKeyId + upload.AliyunOSS.AccessKeySecret = l.svcCtx.Config.AliyunOSS.AccessKeySecret + upload.AliyunOSS.BucketName = l.svcCtx.Config.AliyunOSS.BucketName + upload.AliyunOSS.BucketUrl = l.svcCtx.Config.AliyunOSS.BucketUrl + upload.AliyunOSS.BasePath = l.svcCtx.Config.AliyunOSS.BasePath time.AfterFunc(time.Second*1, func() { - upload.UploadType = "oss" - upload.AliyunOSS.Endpoint = l.svcCtx.Config.AliyunOSS.Endpoint - upload.AliyunOSS.AccessKeyId = l.svcCtx.Config.AliyunOSS.AccessKeyId - upload.AliyunOSS.AccessKeySecret = l.svcCtx.Config.AliyunOSS.AccessKeySecret - upload.AliyunOSS.BucketName = l.svcCtx.Config.AliyunOSS.BucketName - upload.AliyunOSS.BucketUrl = l.svcCtx.Config.AliyunOSS.BucketUrl - upload.AliyunOSS.BasePath = l.svcCtx.Config.AliyunOSS.BasePath err = upload.UploadFileByUrl(resourceId, uploadRes.ResourceUrl) })