Sfoglia il codice sorgente

1.备份相关bug修复

huangxiaodong 1 anno fa
parent
commit
d657d49e46

+ 7 - 0
创维盒子/双子星云手机/NAS/nasBackupsManager/nasBackupsManager.m

@@ -170,6 +170,12 @@
     NSArray* curLocalIdentifierArr = [taskModel.totalLocalIdentifier componentsSeparatedByString:@"&"];
     NSArray* preLocalIdentifierArr = [_lastModel.totalLocalIdentifier componentsSeparatedByString:@"&"];
     
+    //处理异常 (上次没有备份完成)
+    NSInteger totalBackupNum = _lastModel.PreDidBackupsCount + _lastModel.failCount;
+    if(totalBackupNum < preLocalIdentifierArr.count){//preLocalIdentifierArr 改为已经备份过的
+        preLocalIdentifierArr = [preLocalIdentifierArr subarrayWithRange:NSMakeRange(0,totalBackupNum)];
+    }
+    
     NSMutableArray *allArr = [NSMutableArray arrayWithArray:curLocalIdentifierArr];
     
     for (NSString*localIdentifier in preLocalIdentifierArr) {
@@ -334,6 +340,7 @@
     [self beginBackupsFileFun];
 }
 
+#pragma mark 备份失败 待添加重试逻辑
 - (void)changeBackupsFileStateToFailWith:(NSString*)errorStr
 {
     [self deleteVideoFun];

+ 5 - 5
创维盒子/双子星云手机/NAS/nasBackupsManager/nasMixBackupsManager.m

@@ -289,18 +289,18 @@
         [self startUpload:paraDict operation:operation data:curData success:^(id  _Nonnull responseObject) {
             frpUploadModel *model = [[frpUploadModel alloc] initWithDictionary:responseObject error:nil];
             if(model && model.position == operation.fileModel.totalBytes){
-                HLog(@"%@上传完成 数据正常",operation.fileModel.filename)
+                HLog(@"%@备份完成 数据正常",operation.fileModel.filename)
                 [weakSelf handleUploadDoneOneFileBy:operation];
             }
             else if(model && model.position > operation.fileModel.totalBytes){
-                HLog(@"%@上传完成 数据异常 -- position:%ld -- totalBytes:%ld",operation.fileModel.filename,model.position,operation.fileModel.totalBytes)
+                HLog(@"%@备份完成 数据异常 -- position:%ld -- totalBytes:%ld",operation.fileModel.filename,model.position,operation.fileModel.totalBytes)
                 [weakSelf handleUploadDoneOneFileBy:operation];
             }
             else{
-                HLog(@"%@上传完成一片 %ld",operation.fileModel.filename,model.position)
+                HLog(@"%@备份完成一片 %ld",operation.fileModel.filename,model.position)
             }
         } faild:^(NSError * _Nonnull error) {
-            HLog(@"%@上传失败",operation.fileModel.filename)
+            HLog(@"%@备份失败",operation.fileModel.filename)
             [weakSelf handleUploadFailOneFileBy:operation];
         }];
     }
@@ -488,7 +488,7 @@
     [[NSNotificationCenter defaultCenter] postNotificationName:nasBackupsTaskExeError object:operation.fileModel];
     [_uploadingOperationArr removeObject:operation];
     //[self beginUpload];
-    [[nasBackupsManager shareInstance] changeBackupsFileStateToFailWith:@"back fail"];
+    [[nasBackupsManager shareInstance] changeBackupsFileStateToFailWith:@""];
 }
 
 #pragma mark 根据 asset 获取到图片数据

+ 1 - 0
创维盒子/双子星云手机/webRtc/webRtcManager/webRtcManager.m

@@ -139,6 +139,7 @@
     [[errorAlertTool shareInstance] dismissErrorAlertFun];
     
     //处理相册备份
+    [[nasBackupsManager shareInstance] AutohandlePhotosBackupsFun];
     
     //获取磁盘外挂
     [self getExtraFilesListFun];