新增阿里云OSS上传文件逻辑
This commit is contained in:
parent
138b0d0c4e
commit
fea04f12d7
|
@ -109,7 +109,6 @@ func (l *UploadFileBackendLogic) UploadFileBackend(req *types.UploadFileBackendR
|
|||
|
||||
// 是否备份--异步任务
|
||||
if req.BackupType != "" {
|
||||
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
|
||||
|
@ -117,10 +116,11 @@ func (l *UploadFileBackendLogic) UploadFileBackend(req *types.UploadFileBackendR
|
|||
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() {
|
||||
err = upload.UploadFileByUrl(resourceId, uploadRes.ResourceUrl)
|
||||
})
|
||||
}
|
||||
|
||||
// 返回成功的响应和上传URL
|
||||
return resp.SetStatus(basic.CodeOK, map[string]interface{}{
|
||||
"upload_data": UploadUrl{
|
||||
|
|
|
@ -91,7 +91,6 @@ func (l *UploadFileBaseLogic) UploadFileBase(req *types.UploadFileBaseReq, useri
|
|||
|
||||
// 是否备份--异步任务
|
||||
if req.BackupType != "" {
|
||||
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
|
||||
|
@ -99,6 +98,7 @@ func (l *UploadFileBaseLogic) UploadFileBase(req *types.UploadFileBaseReq, useri
|
|||
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() {
|
||||
|
||||
err = upload.UploadFileByUrl(resourceId, uploadRes.ResourceUrl)
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue
Block a user