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) })