Selaa lähdekoodia

1.同名文件上传丢失问题

huangxiaodong 8 kuukautta sitten
vanhempi
commit
fbeb9b0fc0

+ 13 - 5
创维盒子/双子星云手机/NAS/nasUploadManager/nasMixUploadManager.m

@@ -168,6 +168,7 @@
 {
     NSMutableDictionary*paraDict = [NSMutableDictionary new];
     
+    //operation.fileModel.filename = @"Img_4107.png";// test same name file
     if(operation.fileModel.savePath){
         NSString *absPath = [[NSString alloc] initWithFormat:@"%@%@",operation.fileModel.savePath,operation.fileModel.filename];
         [paraDict setValue:absPath forKey:@"absPath"];
@@ -183,7 +184,7 @@
         if(model && model.status == 0){
             [weakSelf checkFileUploadStateFunAfterNetWith:model WithOperation:operation];
         }
-        else if(model && model.status == 5){
+        else if(model && model.status == 5){//云机空间不足
             //上传路径
             NSString * backupsDefaultPath = [HWDataManager getStringWithKey:stringKeyAddSn(Const_photo_upload_default_path)];
             NSArray * stringArr = [backupsDefaultPath componentsSeparatedByString:@"/"];
@@ -221,15 +222,22 @@
     
     if(!model.data.exist){//未上传过
         [self prepareToUploadFileWithOperation:operation];
-    
     }
     else if(model.data.isComplete){//上传过了 并且文件上传完了
         //判断下文件创建长度是否一致 一致则是上传完了 不一致 重新上传一个 可能是同名的文件而已
-        if(model.data.size >= operation.fileModel.totalBytes){//上传完了
+//        if(model.data.size >= operation.fileModel.totalBytes){//上传完了
+//            [self handleFileDidUploadFunWithOperation:operation];
+//        }
+//        else{//未上传完 isComplete 这个字段有问题
+//            operation.fileModel.didUploadBytes = model.data.size;
+//            [self prepareToUploadFileWithOperation:operation];
+//        }
+        
+        //修复同名文件丢失问题
+        if(model.data.size == operation.fileModel.totalBytes){//上传完了
             [self handleFileDidUploadFunWithOperation:operation];
         }
-        else{//未上传完 isComplete 这个字段有问题
-            operation.fileModel.didUploadBytes = model.data.size;
+        else{//同名文件 处理
             [self prepareToUploadFileWithOperation:operation];
         }