root 5 months ago
parent
commit
e6fda92f67
1 changed files with 4 additions and 5 deletions
  1. 4 5
      js/Common/awsupload.js

+ 4 - 5
js/Common/awsupload.js

@@ -61,7 +61,7 @@ async function completeMultipartUpload(parts, keyname) {
         MultipartUpload: { Parts: parts },
         UploadId: uploadid
     };
-    await bucket.completeMultipartUpload(params).promise();
+    return await bucket.completeMultipartUpload(params).promise();
 }
 
 //中止分块上传
@@ -178,7 +178,7 @@ async function awsuploadpart(filestate, file, uploadid, parts, key) {
         }
     }
     //提交上传成功信息
-    await completeMultipartUpload(completeparts, uploadid);
+    return await completeMultipartUpload(completeparts, uploadid);
 }
 
 //上传的接口
@@ -203,12 +203,12 @@ async function awsupload(file, folderid, filestate) {
                 //如果已经部分存在,那么直接在节点续传
                 if (uploadid) {
                     //断点续传
-                    awsuploadpart(filestate, file, uploadid, partsinfo.Parts, key);
+                    return await awsuploadpart(filestate, file, uploadid, partsinfo.Parts, key);
                 }
                 //不存在,上传新的
                 else {
                     const uploadid = await initMultiPartUpload(bucket, params); //初始化文件上传
-                    awsuploadpart(filestate, file, uploadid, [], key);
+                    return await awsuploadpart(filestate, file, uploadid, [], key);
                 }
             }
             //如果已经上传成功了,那么直接返回状态百分百
@@ -223,6 +223,5 @@ async function awsupload(file, folderid, filestate) {
         filestate.status = "error";
         console.log(err);
     }
-    return filestate;
 }