|
@@ -83,10 +83,13 @@ static uploadFileManager * cur_uploadFileShareInstance = nil;
|
|
|
|
|
|
NSLock *lock = [NSLock new];
|
|
NSLock *lock = [NSLock new];
|
|
[lock lock];
|
|
[lock lock];
|
|
- [self->_databaseArr removeAllObjects];
|
|
|
|
- [self->_databaseArr addObject:otherArr];
|
|
|
|
- [self->_databaseArr addObject:doneArr];
|
|
|
|
- [self->_databaseArr addObject:failArr];
|
|
|
|
|
|
+
|
|
|
|
+ NSMutableArray *newArr = [NSMutableArray new];
|
|
|
|
+ [newArr addObject:otherArr];
|
|
|
|
+ [newArr addObject:doneArr];
|
|
|
|
+ [newArr addObject:failArr];
|
|
|
|
+ self->_databaseArr = newArr;
|
|
|
|
+
|
|
[lock unlock];
|
|
[lock unlock];
|
|
|
|
|
|
complete(self->_databaseArr);
|
|
complete(self->_databaseArr);
|
|
@@ -419,34 +422,36 @@ static uploadFileManager * cur_uploadFileShareInstance = nil;
|
|
//HLog(@"ffff:%@",_curUploadFileDataModel.bg_id);
|
|
//HLog(@"ffff:%@",_curUploadFileDataModel.bg_id);
|
|
|
|
|
|
KWeakSelf
|
|
KWeakSelf
|
|
- [uploadFileDataModel bg_findAsync:upLoadFile_image_tableName where:where complete:^(NSArray * _Nullable array) {
|
|
|
|
- for (uploadFileDataModel * curModel in array) {
|
|
|
|
- curModel.curUploadStateType = curUploadStateType;
|
|
|
|
- curModel.didUploadBytes = didUpLoadBytes;
|
|
|
|
-
|
|
|
|
- if(curUploadStateType == uploadStateDone){
|
|
|
|
- curModel.videoData = [NSData new];
|
|
|
|
-
|
|
|
|
- if(curModel.curUploadFileType == uploadFileTypeVideo){
|
|
|
|
- [cachesFileManager removeItemAtPath:curModel.filename type:uploadFileTypeVideo error:nil];
|
|
|
|
|
|
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), ^{
|
|
|
|
+ [uploadFileDataModel bg_findAsync:upLoadFile_image_tableName where:where complete:^(NSArray * _Nullable array) {
|
|
|
|
+ for (uploadFileDataModel * curModel in array) {
|
|
|
|
+ curModel.curUploadStateType = curUploadStateType;
|
|
|
|
+ curModel.didUploadBytes = didUpLoadBytes;
|
|
|
|
+
|
|
|
|
+ if(curUploadStateType == uploadStateDone){
|
|
|
|
+ curModel.videoData = [NSData new];
|
|
|
|
+
|
|
|
|
+ if(curModel.curUploadFileType == uploadFileTypeVideo){
|
|
|
|
+ [cachesFileManager removeItemAtPath:curModel.filename type:uploadFileTypeVideo error:nil];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ [weakSelf handleDatabaseArrByDelete:curModel];
|
|
|
|
+ [weakSelf handleDatabaseArrByInDone:curModel];
|
|
|
|
+ }
|
|
|
|
+ else if(curUploadStateType == uploadStateFail){
|
|
|
|
+ [weakSelf handleDatabaseArrByDelete:curModel];
|
|
|
|
+ [weakSelf handleDatabaseArrByInFail:curModel];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ [curModel bg_saveOrUpdateAsync:^(BOOL isSuccess) {
|
|
|
|
+ //HLog(@"%@ 写入 %@", model.filename, isSuccess ? @"成功":@"失败");
|
|
|
|
+ }];
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
- [weakSelf handleDatabaseArrByDelete:curModel];
|
|
|
|
- [weakSelf handleDatabaseArrByInDone:curModel];
|
|
|
|
- }
|
|
|
|
- else if(curUploadStateType == uploadStateFail){
|
|
|
|
- [weakSelf handleDatabaseArrByDelete:curModel];
|
|
|
|
- [weakSelf handleDatabaseArrByInFail:curModel];
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- [curModel bg_saveOrUpdateAsync:^(BOOL isSuccess) {
|
|
|
|
- //HLog(@"%@ 写入 %@", model.filename, isSuccess ? @"成功":@"失败");
|
|
|
|
|
|
+ complete(YES);
|
|
}];
|
|
}];
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- complete(YES);
|
|
|
|
- }];
|
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|