|
@@ -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
|
|
|
|