Browse Source

1.修复进入传输列表--下载完成后检测文件是否存储完卡顿问题
2.每次进入传输列表 不再重新获取数据库数据 (没有才去获取)

huangxiaodong 8 months ago
parent
commit
5747796267

+ 2 - 2
创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileRecordViewController.m

@@ -542,7 +542,7 @@
     BOOL isNeedRegetDataType = !isUploadingType;
     
     KWeakSelf
-    [[nasUploadFileManager shareInstance] getDataInDatabaseFun:isNeedRegetDataType complete:^(NSMutableArray * _Nonnull Arr) {
+    [[nasUploadFileManager shareInstance] getDataInDatabaseFun:NO complete:^(NSMutableArray * _Nonnull Arr) {
         //[weakSelf setRecordBodyDataFunBy:Arr];
         
         weakSelf.didGetUploadDataType = YES;
@@ -608,7 +608,7 @@
     
     
     KWeakSelf
-    [[nasDownloadFileManager shareInstance] getDataInDatabaseFun:isRegetType complete:^(NSMutableArray * _Nonnull Arr) {
+    [[nasDownloadFileManager shareInstance] getDataInDatabaseFun:NO complete:^(NSMutableArray * _Nonnull Arr) {
       
         weakSelf.didGetDownloadDataType = YES;
         [weakSelf handleRemoveIndicator];

+ 32 - 19
创维盒子/双子星云手机/NAS/nasDownloadManager/nasDownloadFileManager.m

@@ -141,7 +141,7 @@ static nasDownloadFileManager * cur_nasDownloadFileManager = nil;
     }
     
     //KWeakSelf
-    //dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), ^{
+    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), ^{
 //    NSLock *lock = [NSLock new];
 //    [lock lock];
         [couldPhoneFileModel bg_findAsync:nas_box_download_tableName limit:0 orderBy:nil desc:YES complete:^(NSArray * _Nullable array) {
@@ -180,7 +180,7 @@ static nasDownloadFileManager * cur_nasDownloadFileManager = nil;
             complete(self->_databaseArr);
         }];
    // [lock unlock];
-    //});
+    });
 
 }
 
@@ -679,27 +679,40 @@ static nasDownloadFileManager * cur_nasDownloadFileManager = nil;
 #pragma mark-查询还有没有没处理的任务
 - (void)checkDownloadDonePlistInfoFun
 {
-    NSMutableDictionary *dictM =  [[self getDownloadDownList] mutableCopy];
-    if(dictM.count > 0){
-        for (NSString*key in dictM) {
-            NSDictionary*dict = dictM[key];
-            customDownloadOperation *model = [customDownloadOperation mj_objectWithKeyValues:dict];
+    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), ^{
+        NSMutableDictionary *dictM =  [[self getDownloadDownList] mutableCopy];
+        NSMutableArray *needDeletekeyArr = [NSMutableArray array];
+        if(dictM.count > 0){
+            for (NSString*key in dictM) {
+                NSDictionary*dict = dictM[key];
+                customDownloadOperation *model = [customDownloadOperation mj_objectWithKeyValues:dict];
+                
+                NSString*curFullPath = [customDownloadCacheManager getFullPathByOldFullPath:model.fullPath];
+                //判断文件是否还存在
+                if (![[NSFileManager defaultManager] fileExistsAtPath:curFullPath]) {
+                    //不存在 删除信息
+                    //[self deleteFileInfoWithUrl:key];
+                    [needDeletekeyArr addObject:key];
+                }
+                else{//存在 通知保存流程
+                    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+                        [[webRtcManager shareManager] NasDownloadTaskFinishedNoti:model];
+                    });
+                    break;
+                }
+            }
             
-            NSString*curFullPath = [customDownloadCacheManager getFullPathByOldFullPath:model.fullPath];
-            //判断文件是否还存在
-            if (![[NSFileManager defaultManager] fileExistsAtPath:curFullPath]) {
-                //不存在 删除信息
+        }
+        
+        if(needDeletekeyArr.count > 0){
+            for(NSString*key in needDeletekeyArr){
                 [self deleteFileInfoWithUrl:key];
+                [dictM removeObjectForKey:key];
             }
-            else{//存在 通知保存流程
-                dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-                    [[webRtcManager shareManager] NasDownloadTaskFinishedNoti:model];
-                });
-                break;
-            }
+            [needDeletekeyArr removeAllObjects];
         }
-        
-    }
+            
+    });
 }
 @end