|
@@ -279,6 +279,9 @@
|
|
|
else if(uploadFileDataMod.curUploadFileType == uploadFileTypeFileAPP){
|
|
|
[cachesFileManager removeItemAtPath:uploadFileDataMod.filename type:uploadFileTypeFileAPP error:nil];
|
|
|
}
|
|
|
+ else if(uploadFileDataMod.curUploadFileType == uploadFileTypeRecord){
|
|
|
+ //录音上传完不删除
|
|
|
+ }
|
|
|
|
|
|
uploadFileDataMod = nil;
|
|
|
}
|
|
@@ -835,4 +838,86 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+//把录音filePath 转成 我们需要上传的model
|
|
|
+- (void)handlToRecorUploadFileDataFunBy:(NSArray*)recordFileArr complete:(custom_complete_Arr)complete
|
|
|
+{
|
|
|
+ if(!recordFileArr && recordFileArr.count == 0){
|
|
|
+ complete(_databaseArr);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ _isNewAddTaskType = YES;
|
|
|
+
|
|
|
+ NSMutableArray *newUploadTaskArr = [NSMutableArray new];
|
|
|
+
|
|
|
+ for (recordFileModel * recordModel in recordFileArr) {
|
|
|
+ uploadFileDataModel * curModel = [uploadFileDataModel new];
|
|
|
+
|
|
|
+ // 获取文件名称
|
|
|
+ NSString *fileName = recordModel.fileName;
|
|
|
+ curModel.filename = fileName;
|
|
|
+ curModel.curUploadFileType = uploadFileTypeRecord;
|
|
|
+ BOOL isRepeatingTasksType = NO;
|
|
|
+
|
|
|
+ //查询上传任务是否存在
|
|
|
+ if(_databaseArr && _databaseArr.count == 3 ){
|
|
|
+ NSMutableArray *uploadingArr = [[NSMutableArray alloc] initWithArray:_databaseArr[0]];
|
|
|
+ for (uploadFileDataModel *preModel in uploadingArr) {
|
|
|
+ if([preModel.filename isEqualToString:curModel.filename]
|
|
|
+ && preModel.curUploadFileType == uploadFileTypeRecord){
|
|
|
+ isRepeatingTasksType = YES;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(isRepeatingTasksType){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ NSString * uploadDefaultPath = [HWDataManager getStringWithKey:stringKeyAddSn(Const_photo_upload_default_path)];
|
|
|
+ if(!uploadDefaultPath || uploadDefaultPath.length == 0){
|
|
|
+ [HWDataManager setStringWithKey:stringKeyAddSn(Const_photo_upload_default_path) value:Const_default_upload_path];
|
|
|
+ uploadDefaultPath = Const_default_upload_path;
|
|
|
+ }
|
|
|
+
|
|
|
+ //判断最后一个是否是/
|
|
|
+ NSString *lastStr= [uploadDefaultPath substringFromIndex:uploadDefaultPath.length-1];
|
|
|
+ if(![lastStr isEqualToString:@"/"]){
|
|
|
+ uploadDefaultPath = [[NSString alloc] initWithFormat:@"%@/",uploadDefaultPath];
|
|
|
+ }
|
|
|
+
|
|
|
+ //NSString*savePath = [[NSString alloc] initWithFormat:@"%@%@",uploadDefaultPath,filePath];
|
|
|
+ curModel.savePath = uploadDefaultPath;
|
|
|
+
|
|
|
+ curModel.curUploadStateType = uploadStateUploading;
|
|
|
+
|
|
|
+// NSString *documentsDirectory = kSHPath_FileAPP;
|
|
|
+// // 构建目标文件路径
|
|
|
+// NSString *destinationPath = [documentsDirectory stringByAppendingPathComponent:fileName];
|
|
|
+ NSString *destinationPath = recordModel.filePath;
|
|
|
+ curModel.totalBytes = [iTools getFileSize:destinationPath];
|
|
|
+
|
|
|
+ //保存到数据库
|
|
|
+ curModel.bg_tableName = nasUpLoadFile_tableName;
|
|
|
+ [newUploadTaskArr addObject:curModel];
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ KWeakSelf
|
|
|
+ if(newUploadTaskArr.count == 0){
|
|
|
+ [self getDataInDatabaseFun:YES complete:^(NSMutableArray * _Nonnull Arr) {
|
|
|
+ complete(Arr);
|
|
|
+ [weakSelf handleUploadFileModelBg_idFun:Arr];
|
|
|
+ }];
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ [uploadFileDataModel bg_saveOrUpdateArrayAsync:newUploadTaskArr complete:^(BOOL isSuccess) {
|
|
|
+ [weakSelf getDataInDatabaseFun:YES complete:^(NSMutableArray * _Nonnull Arr) {
|
|
|
+ complete(Arr);
|
|
|
+ [weakSelf handleUploadFileModelBg_idFun:Arr];
|
|
|
+ }];
|
|
|
+ }];
|
|
|
+ }
|
|
|
+}
|
|
|
@end
|