Преглед изворни кода

1.文件APP 上传文件 初步调试完成

huangxiaodong пре 8 месеци
родитељ
комит
d50bf4fed5
20 измењених фајлова са 445 додато и 29 уклоњено
  1. 5 5
      创维盒子/code/AppDelegate/AppDelegate.m
  2. 22 0
      创维盒子/code/Assets.xcassets/NAS/uploadFile_file_bigger.imageset/Contents.json
  3. BIN
      创维盒子/code/Assets.xcassets/NAS/uploadFile_file_bigger.imageset/uploadFile_file_bigger@2x.png
  4. BIN
      创维盒子/code/Assets.xcassets/NAS/uploadFile_file_bigger.imageset/uploadFile_file_bigger@3x.png
  5. 3 2
      创维盒子/code/Class/Set/previewFile/view/previewToUploadFileView.m
  6. 1 1
      创维盒子/code/Class/Set/uploadFile/model/uploadFileDataModel.h
  7. 4 0
      创维盒子/code/Class/Set/uploadFile/uploadFileManager/cachesFileManager.h
  8. 5 0
      创维盒子/code/Class/Set/uploadFile/uploadFileManager/cachesFileManager.m
  9. 3 0
      创维盒子/code/Class/Set/uploadFile/uploadFileRecordViewController.h
  10. 28 0
      创维盒子/code/Class/Set/uploadFile/uploadFileRecordViewController.m
  11. 4 1
      创维盒子/code/Class/Set/uploadFile/uploadFileView/uploadFileRecordCell.m
  12. 3 0
      创维盒子/code/Helpers/iTools.h
  13. 24 0
      创维盒子/code/Helpers/iTools.m
  14. 24 0
      创维盒子/code/NAS/DocumentPickerManager/DocumentPickerManager.h
  15. 131 0
      创维盒子/code/NAS/DocumentPickerManager/DocumentPickerManager.m
  16. 24 5
      创维盒子/code/NAS/NASViewController.m
  17. 44 4
      创维盒子/code/NAS/nasUploadManager/nasMixUploadManager.m
  18. 3 0
      创维盒子/code/NAS/nasUploadManager/nasUploadFileManager.h
  19. 97 11
      创维盒子/code/NAS/nasUploadManager/nasUploadFileManager.m
  20. 20 0
      创维盒子/双子星云手机.xcodeproj/project.pbxproj

+ 5 - 5
创维盒子/code/AppDelegate/AppDelegate.m

@@ -65,12 +65,12 @@
     [AMediaStream globalInitialization];
     
     //保护App,一般常见的问题不会导致闪退,增强App的健壮性,同时会将错误抛出来,根据每个App自身的日志渠道记录
-    [JJException configExceptionCategory:JJExceptionGuardAll];
-    [JJException startGuardException];
-    [JJException registerExceptionHandle:self];
+//    [JJException configExceptionCategory:JJExceptionGuardAll];
+//    [JJException startGuardException];
+//    [JJException registerExceptionHandle:self];
     
-//    //Default value:NO  no表示异常不退出 YES 表示退出  开发时应该设置为YES
-//    JJException.exceptionWhenTerminate = YES;
+    //Default value:NO  no表示异常不退出 YES 表示退出  开发时应该设置为YES
+    //JJException.exceptionWhenTerminate = YES;
 
     
     //test code

+ 22 - 0
创维盒子/code/Assets.xcassets/NAS/uploadFile_file_bigger.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "uploadFile_file_bigger@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "uploadFile_file_bigger@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
创维盒子/code/Assets.xcassets/NAS/uploadFile_file_bigger.imageset/uploadFile_file_bigger@2x.png


BIN
创维盒子/code/Assets.xcassets/NAS/uploadFile_file_bigger.imageset/uploadFile_file_bigger@3x.png


+ 3 - 2
创维盒子/code/Class/Set/previewFile/view/previewToUploadFileView.m

@@ -103,11 +103,12 @@
    
     
     NSArray *titleArr = @[NSLocalizedString(@"my_set_no_image_upload",nil),
-                          NSLocalizedString(@"my_set_no_video_upload",nil)];
+                          NSLocalizedString(@"my_set_no_video_upload",nil)
+                          ,NSLocalizedString(@"my_set_no_file",nil)];
   
     NSArray *imageStrArr = @[@"uploadFile_image_bigger",
                              @"uploadFile_Video_bigger"
-                             ];
+                             ,@"uploadFile_file_bigger"];
     
     CGFloat curButFullWidth = SCREEN_W/4.0;
     

+ 1 - 1
创维盒子/code/Class/Set/uploadFile/model/uploadFileDataModel.h

@@ -21,7 +21,7 @@ typedef enum{
 typedef enum{
     uploadFileTypeImage = 0,
     uploadFileTypeVideo,
-    uploadFileTypeUnkonw,
+    uploadFileTypeFileAPP,//(文件APP里的文件)
     DownLoadThumbnail,//下载缩略图
     DownLoadFileType,//下载文件
 }uploadFileType;

+ 4 - 0
创维盒子/code/Class/Set/uploadFile/uploadFileManager/cachesFileManager.h

@@ -13,6 +13,10 @@
 #define kSHPath_image [cachesFileManager getCreateFilePath:[NSString stringWithFormat:@"%@/Image",CachesPatch]]
 //视频路径
 #define kSHPath_video [cachesFileManager getCreateFilePath:[NSString stringWithFormat:@"%@/Video",CachesPatch]]
+
+//从文件APP中 拷贝到app里面
+#define kSHPath_FileAPP [cachesFileManager getCreateFilePath:[NSString stringWithFormat:@"%@/FileApp",CachesPatch]]
+
 //下载缩略图 图片 DownLoadThumbnail
 #define kSHPath_DownLoadThumbnail [cachesFileManager getCreateFilePath:[NSString stringWithFormat:@"%@/DownLoadThumbnail",CachesPatch]]
 

+ 5 - 0
创维盒子/code/Class/Set/uploadFile/uploadFileManager/cachesFileManager.m

@@ -132,6 +132,11 @@
             name = [NSString stringWithFormat:@"%@/%@",kSHPath_video,name];
         }
             break;
+        case uploadFileTypeFileAPP://文件APP
+        {
+            name = [NSString stringWithFormat:@"%@/%@",kSHPath_FileAPP,name];
+        }
+            break;
         case DownLoadThumbnail://image
         {
             name = [NSString stringWithFormat:@"%@/%@.png",kSHPath_DownLoadThumbnail,name];

+ 3 - 0
创维盒子/code/Class/Set/uploadFile/uploadFileRecordViewController.h

@@ -18,7 +18,10 @@ NS_ASSUME_NONNULL_BEGIN
 @interface uploadFileRecordViewController : BaseViewController
 //
 @property (nonatomic, assign) BOOL isUploadingType;//上传页面进入
+//处理相册的 图片或者视频
 -(void)gotoUploadFile:(NSMutableArray*)indexPathsForSelectedItems;
+//处理文件app上传的文件
+-(void)gotoUploadFileByFileApp:(NSArray*)FileUrl;
 
 @property (nonatomic, assign) BOOL isDownloadingType;//下载页面进入
 -(void)gotoDownloadFile:(NSMutableArray*)selectedItems;

+ 28 - 0
创维盒子/code/Class/Set/uploadFile/uploadFileRecordViewController.m

@@ -600,6 +600,34 @@
     }];
 }
 
+//处理文件app上传的文件
+-(void)gotoUploadFileByFileApp:(NSArray*)FileUrls{
+    
+    KWeakSelf
+    mainBlock(^{
+        weakSelf.didGetUploadDataType = YES;
+        [weakSelf handleRemoveIndicator];
+    });
+    
+    [self realGotoUploadFileByFileApp:FileUrls];
+}
+
+- (void)realGotoUploadFileByFileApp:(NSArray *)URLArr
+{
+    KWeakSelf
+    [[nasUploadFileManager shareInstance] handlUrlToUploadFileDataFunBy:URLArr complete:^(NSMutableArray * _Nonnull Arr) {
+        //NSMutableArray *arr1 = Arr;
+        //[weakSelf setRecordBodyDataFunBy:arr1];
+        
+        //weakSelf.leftTableView.curDataArr = Arr[0];
+        mainBlock(^{
+            weakSelf.leftTableView.outSideDataArr = Arr;
+            [weakSelf handleUploadingRightButFun:YES];
+        });
+        
+    }];
+}
+
 #pragma mark 读取数据库数据
 - (void)getUploadDataInDatabaseFun
 {

+ 4 - 1
创维盒子/code/Class/Set/uploadFile/uploadFileView/uploadFileRecordCell.m

@@ -262,7 +262,7 @@
                 }
             }
         }
-        else{
+        else if(curUploadFileDataModel.curUploadFileType == uploadFileTypeVideo){
             NSString*pathStr = [cachesFileManager getFilePathWithName:curUploadFileDataModel.videoFirstImageName type:uploadFileTypeImage];
              UIImage *image = [UIImage imageWithContentsOfFile:pathStr];
             
@@ -293,6 +293,9 @@
                 }];
             }
         }
+        else{//文件APP
+            _fileImageView.image = [UIImage imageNamed:@"uploadFile_other"];
+        }
     }
     
     

+ 3 - 0
创维盒子/code/Helpers/iTools.h

@@ -192,6 +192,9 @@ NS_ASSUME_NONNULL_BEGIN
 
 //传输用的路径换成显示的路径
 + (NSString *)changePathToShowPathBy:(NSString*)path;
+
+//获取文件大小
++ (unsigned long long)getFileSize:(NSString *)filePath;
 @end
 
 NS_ASSUME_NONNULL_END

+ 24 - 0
创维盒子/code/Helpers/iTools.m

@@ -1456,4 +1456,28 @@ static const char encodingTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopq
     
     return path;
 }
+
+//获取文件大小
++ (unsigned long long)getFileSize:(NSString *)filePath
+{
+    NSFileManager *fileManager = [NSFileManager defaultManager];
+    
+    // 检查文件是否存在
+    if ([fileManager fileExistsAtPath:filePath]) {
+        // 获取文件属性
+        NSError *error = nil;
+        NSDictionary *attributes = [fileManager attributesOfItemAtPath:filePath error:&error];
+        
+        if (error) {
+            HLog(@"Error getting file attributes: %@", error.localizedDescription);
+            return 0;
+        }
+        
+        // 返回文件大小
+        return [attributes fileSize];
+    } else {
+        HLog(@"File does not exist at path: %@", filePath);
+        return 0;
+    }
+}
 @end

+ 24 - 0
创维盒子/code/NAS/DocumentPickerManager/DocumentPickerManager.h

@@ -0,0 +1,24 @@
+//
+//  DocumentPickerManager.h
+//  隐私保护
+//
+//  Created by xd h on 2025/3/21.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ *  成功请求Block返回的字典
+ */
+typedef void (^pickerSuccess) (NSArray* urls);
+
+@interface DocumentPickerManager : NSObject
+/** 实例化对象(单例) */
++ (instancetype)shareManager;
+
+- (void)openDocumentPickerSuccess:(pickerSuccess)success;
+@end
+
+NS_ASSUME_NONNULL_END

+ 131 - 0
创维盒子/code/NAS/DocumentPickerManager/DocumentPickerManager.m

@@ -0,0 +1,131 @@
+//
+//  DocumentPickerManager.m
+//  隐私保护
+//
+//  Created by xd h on 2025/3/21.
+//
+
+#import "DocumentPickerManager.h"
+#import <UIKit/UIKit.h>
+#import <MobileCoreServices/MobileCoreServices.h>
+
+@interface DocumentPickerManager () <UIDocumentPickerDelegate>
+{
+    NSArray *curURLS;
+    NSInteger PickerTotalNumber;//用户选择的数目
+    NSInteger didPickerOkNumber;//拷贝到APP内成功的数量
+    NSInteger didPickerFailNumber;//拷贝到APP内失败的数量
+}
+
+@property (nonatomic,copy) pickerSuccess didPickSuc;
+@end
+
+@implementation DocumentPickerManager
++ (instancetype)shareManager {
+    static DocumentPickerManager *_instance;
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        _instance = [[self alloc] init];
+    });
+    return _instance;
+}
+
+
+- (void)openDocumentPickerSuccess:(pickerSuccess)success {
+    
+    PickerTotalNumber = 0;
+    didPickerOkNumber = 0;
+    didPickerFailNumber = 0;
+    
+    _didPickSuc = success;
+    
+    // 创建 UIDocumentPickerViewController
+    UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[(NSString *)kUTTypeItem] inMode:UIDocumentPickerModeImport];
+    
+    // 启用多选
+    documentPicker.allowsMultipleSelection = YES;
+    // 设置代理
+    documentPicker.delegate = self;
+    
+    // 设置模态呈现样式
+    documentPicker.modalPresentationStyle = UIModalPresentationFormSheet;
+    
+    // 弹出文档选择器
+    UIViewController* vc = [iTools appRootViewController];
+    [vc presentViewController:documentPicker animated:YES completion:nil];
+}
+
+#pragma mark - UIDocumentPickerDelegate
+
+- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentsAtURLs:(NSArray<NSURL *> *)urls {
+    
+    PickerTotalNumber = urls.count;
+    curURLS = urls;
+    for (NSURL *fileURL in urls) {
+        // 将文件保存到应用的沙盒目录
+        [self saveFileToAppSandbox:fileURL];
+    }
+}
+
+- (void)documentPickerWasCancelled:(UIDocumentPickerViewController *)controller {
+    // 用户取消了文件选择
+    HLog(@"Document picker was cancelled");
+}
+
+- (void)saveFileToAppSandbox:(NSURL *)fileURL {
+    // 获取文件名称
+    NSString *fileName = [fileURL lastPathComponent];
+    
+    // 获取应用的 Documents 目录路径
+//    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+//    NSString *documentsDirectory = [paths firstObject];
+    
+    NSString *documentsDirectory = kSHPath_FileAPP;
+    
+    // 构建目标文件路径
+    NSString *destinationPath = [documentsDirectory stringByAppendingPathComponent:fileName];
+    NSURL *destinationURL = [NSURL fileURLWithPath:destinationPath];
+    
+    // 检查文件是否已经存在
+    if ([[NSFileManager defaultManager] fileExistsAtPath:destinationPath]) {
+        HLog(@"文件已存在: %@", destinationPath);
+        didPickerOkNumber ++;
+        [self didFinishPickerTaskFun];
+        return;
+    }
+    
+    // 将文件从临时位置复制到目标路径
+    KWeakSelf
+    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+        NSError *error;
+        BOOL success = [[NSFileManager defaultManager] copyItemAtURL:fileURL toURL:destinationURL error:&error];
+        
+        if (success) {
+            HLog(@"文件保存成功: %@", destinationPath);
+            self->didPickerOkNumber ++;
+        } else {
+            HLog(@"文件保存失败: %@", error.localizedDescription);
+            self->didPickerFailNumber ++;
+        }
+        
+        mainBlock(^{
+            [weakSelf didFinishPickerTaskFun];
+        });
+        
+    });
+}
+
+#pragma mark 判断是否处理完成数据
+- (void)didFinishPickerTaskFun
+{
+    if (didPickerOkNumber + didPickerFailNumber < PickerTotalNumber ) {
+        return;
+    }
+    
+    HLog(@"处理完成了")
+    
+    if(_didPickSuc){
+        _didPickSuc(curURLS);
+    }
+}
+@end

+ 24 - 5
创维盒子/code/NAS/NASViewController.m

@@ -45,6 +45,7 @@
 #import "searchBarView.h"
 #import "NasPreviewAPPViewController.h"
 #import "NasSearchViewController.h"
+#import "DocumentPickerManager.h"
 
 @interface NASViewController ()<UITableViewDelegate,UITableViewDataSource>
 {
@@ -674,14 +675,22 @@
 #pragma mark 调整文件上传
 - (void)gotoUploadFileFunWith:(NSInteger)tag
 {
-    uploadImageOrVideoViewController *vc = [uploadImageOrVideoViewController new];
-    if(tag ==10){
-        vc.isPhotoType = YES;
+    if(tag == 10 || tag == 11){
+        uploadImageOrVideoViewController *vc = [uploadImageOrVideoViewController new];
+        if(tag ==10){
+            vc.isPhotoType = YES;
+        }
+        else{
+            vc.isPhotoType = NO;
+        }
+        [self pushViewController:vc animated:YES];
     }
     else{
-        vc.isPhotoType = NO;
+        KWeakSelf
+        [[DocumentPickerManager shareManager] openDocumentPickerSuccess:^(NSArray * _Nonnull urls) {
+            [weakSelf gotoUploadFileRecordByFileAppWithUrls:urls];
+        }];
     }
-    [self pushViewController:vc animated:YES];
 }
 
 #pragma mark 获取到云机磁盘相关信息
@@ -1141,4 +1150,14 @@
     NasSearchViewController *vc = [NasSearchViewController new];
     [self pushViewController:vc animated:YES];
 }
+
+#pragma mark 文件上传跳转上传记录
+- (void)gotoUploadFileRecordByFileAppWithUrls:(NSArray*)urls
+{
+    uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
+    [self.navigationController pushViewController:vc animated:YES];
+    vc.isUploadingType = YES;
+    [vc gotoUploadFileByFileApp:urls];
+    
+}
 @end

+ 44 - 4
创维盒子/code/NAS/nasUploadManager/nasMixUploadManager.m

@@ -51,7 +51,15 @@
         
         //1. 排查上传中
         for (customUploadOperation *operationDoing in self.uploadingOperationArr) {
-            if([operationDoing.fileModel.localIdentifier isEqualToString:model.localIdentifier]){
+            if(operationDoing.fileModel.localIdentifier && [operationDoing.fileModel.localIdentifier isEqualToString:model.localIdentifier]){
+                needAddType = NO;
+                break;
+            }
+            
+            //文件APP上传处理
+            if (model.curUploadFileType == uploadFileTypeFileAPP
+                && operationDoing.fileModel.curUploadFileType == uploadFileTypeFileAPP
+                && [operationDoing.fileModel.filename isEqualToString:model.filename]) {
                 needAddType = NO;
                 break;
             }
@@ -59,7 +67,15 @@
         
         //1. 排查等待下载
         for (uploadFileDataModel *waitModel in self.uploadWaitingUrlArr) {
-            if([waitModel.localIdentifier isEqualToString:model.localIdentifier]){
+            if(waitModel.localIdentifier && [waitModel.localIdentifier isEqualToString:model.localIdentifier]){
+                needAddType = NO;
+                break;
+            }
+            
+            //文件APP上传处理
+            if (waitModel.curUploadFileType == uploadFileTypeFileAPP
+                && model.curUploadFileType == uploadFileTypeFileAPP
+                && [waitModel.filename isEqualToString:model.filename]) {
                 needAddType = NO;
                 break;
             }
@@ -403,7 +419,7 @@
             [weakSelf handleUploadFailOneFileBy:operation];
         }];
     }
-    else{
+    else if(operation.fileModel.curUploadFileType == uploadFileTypeVideo){
         [paraDict setObject:@1 forKey:@"videoType"];
         [paraDict setObject:@"false" forKey:@"isLast"];
 
@@ -449,10 +465,28 @@
             
         }];
     }
+    else if(operation.fileModel.curUploadFileType == uploadFileTypeFileAPP){
+        //上传文件
+        [paraDict setObject:@3 forKey:@"videoType"];
+        [paraDict setObject:@"false" forKey:@"isLast"];
+
+        if(![cachesFileManager checkFileIsSaveState:operation.fileModel.filename withType:uploadFileTypeFileAPP]){
+            
+            [weakSelf handleUploadFailOneFileBy:operation];
+            return;
+        }
+        
+        long curPosition = operation.fileModel.didUploadBytes;
+        [self beginUploadVideoDataFunBy:operation with:curPosition withPara:paraDict success:^(id  _Nonnull responseObject) {
+            
+        } faild:^(NSError * _Nonnull error) {
+            
+        }];
+    }
     
 }
 
-#pragma mark 视频上传
+#pragma mark 视频上传 或者文件APP上传
 - (void)beginUploadVideoDataFunBy:(customUploadOperation*)operation with:(NSInteger)position withPara:(NSMutableDictionary*)paraDict success:(netWork_Success)success faild:(netWork_Faild)faildStr
 {
     if(operation.isCancelType){
@@ -515,8 +549,14 @@
     
     HLog(@"视频切片开始 线程:%@",[NSThread currentThread]);
     
+    //视频
     NSString *filePath = [cachesFileManager getFilePathWithName:dataModel.filename type:uploadFileTypeVideo]; // 文件路径
     
+    //文件APP
+    if (dataModel.curUploadFileType == uploadFileTypeFileAPP) {
+        filePath = [cachesFileManager getFilePathWithName:dataModel.filename type:uploadFileTypeFileAPP]; // 文件路径
+    }
+    
     NSFileManager *manager0 = [NSFileManager defaultManager];
     if(![manager0 fileExistsAtPath:filePath]) {
      

+ 3 - 0
创维盒子/code/NAS/nasUploadManager/nasUploadFileManager.h

@@ -34,6 +34,9 @@ NS_ASSUME_NONNULL_BEGIN
 //把TZAssetModel 转成 我们需要上传的model
 - (void)handlTZAssetModelToUploadFileDataFunBy:(NSMutableArray*)indexPathsForSelectedItems complete:(custom_complete_Arr)complete;
 
+//把url 转成 我们需要上传的model
+- (void)handlUrlToUploadFileDataFunBy:(NSArray*)UrlArr complete:(custom_complete_Arr)complete;
+
 //删除本地数据库记录
 - (void)deleteUploadFileRecordBy:(NSMutableArray *)delArr withDelCache:(BOOL)isDelCache complete:(custom_complete_B)complete;
 

+ 97 - 11
创维盒子/code/NAS/nasUploadManager/nasUploadFileManager.m

@@ -102,17 +102,17 @@
         return;
     }
     
-    if(ksharedAppDelegate.DisabledFileTransferType){
-        if(ksharedAppDelegate.isImageNewFor130){
-            [[iToast makeText:NSLocalizedString(@"File_Transfer_Disable_tip",nil)] show];
-        }
-        else{
-            [[iToast makeText:NSLocalizedString(@"File_Transfer_Disable_tip2",nil)] show];
-        }
-        
-        complete(_databaseArr);
-        return;
-    }
+//    if(ksharedAppDelegate.DisabledFileTransferType){
+//        if(ksharedAppDelegate.isImageNewFor130){
+//            [[iToast makeText:NSLocalizedString(@"File_Transfer_Disable_tip",nil)] show];
+//        }
+//        else{
+//            [[iToast makeText:NSLocalizedString(@"File_Transfer_Disable_tip2",nil)] show];
+//        }
+//        
+//        complete(_databaseArr);
+//        return;
+//    }
     
     _isNewAddTaskType = YES;
     
@@ -746,4 +746,90 @@
         [[nasMixUploadManager shareManager] addUploadWithModels:self.uploadingArr];
     }
 }
+
+
+
+#pragma mark 文件APP里的文件上传
+- (void)handlUrlToUploadFileDataFunBy:(NSArray*)UrlArr complete:(custom_complete_Arr)complete
+{
+    if(!UrlArr && UrlArr.count == 0){
+        complete(_databaseArr);
+        return;
+    }
+    
+    _isNewAddTaskType = YES;
+    
+    NSMutableArray *newUploadTaskArr = [NSMutableArray new];
+    
+    for (NSURL * fileURL in UrlArr) {
+        uploadFileDataModel * curModel = [uploadFileDataModel new];
+        
+        // 获取文件名称
+        NSString *fileName = [fileURL lastPathComponent];
+        curModel.filename = fileName;
+        curModel.curUploadFileType = uploadFileTypeFileAPP;
+        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 ==  uploadFileTypeFileAPP){
+                    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];
+        
+        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

+ 20 - 0
创维盒子/双子星云手机.xcodeproj/project.pbxproj

@@ -194,6 +194,10 @@
 		6B0D004C2BFE104B00F02719 /* queryOneShareModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B0D00492BFE104B00F02719 /* queryOneShareModel.h */; };
 		6B0D004D2BFE104B00F02719 /* queryOneShareModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B0D00492BFE104B00F02719 /* queryOneShareModel.h */; };
 		6B0D004E2BFE104B00F02719 /* queryOneShareModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0D004A2BFE104B00F02719 /* queryOneShareModel.m */; };
+		6B1774F22D8D003E001082D9 /* DocumentPickerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B1774F12D8D003E001082D9 /* DocumentPickerManager.m */; };
+		6B1774F32D8D003E001082D9 /* DocumentPickerManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B1774F02D8D003E001082D9 /* DocumentPickerManager.h */; };
+		6B1774F42D8D003E001082D9 /* DocumentPickerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B1774F12D8D003E001082D9 /* DocumentPickerManager.m */; };
+		6B1774F52D8D003E001082D9 /* DocumentPickerManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B1774F02D8D003E001082D9 /* DocumentPickerManager.h */; };
 		6B1B0AE32D1AA1EF0044FC55 /* webRtcPingManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B1B0AE12D1AA1EF0044FC55 /* webRtcPingManager.h */; };
 		6B1B0AE42D1AA1EF0044FC55 /* webRtcPingManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B1B0AE22D1AA1EF0044FC55 /* webRtcPingManager.m */; };
 		6B1B0AE52D1AA1EF0044FC55 /* webRtcPingManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B1B0AE12D1AA1EF0044FC55 /* webRtcPingManager.h */; };
@@ -1741,6 +1745,8 @@
 		6B0A75DE2C4CA3D300DCB32D /* audioPlayingView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = audioPlayingView.m; sourceTree = "<group>"; };
 		6B0D00492BFE104B00F02719 /* queryOneShareModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = queryOneShareModel.h; sourceTree = "<group>"; };
 		6B0D004A2BFE104B00F02719 /* queryOneShareModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = queryOneShareModel.m; sourceTree = "<group>"; };
+		6B1774F02D8D003E001082D9 /* DocumentPickerManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DocumentPickerManager.h; sourceTree = "<group>"; };
+		6B1774F12D8D003E001082D9 /* DocumentPickerManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DocumentPickerManager.m; sourceTree = "<group>"; };
 		6B1B0AE12D1AA1EF0044FC55 /* webRtcPingManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = webRtcPingManager.h; sourceTree = "<group>"; };
 		6B1B0AE22D1AA1EF0044FC55 /* webRtcPingManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = webRtcPingManager.m; sourceTree = "<group>"; };
 		6B1CC2C42B677F3D00AD4217 /* extraMediaEventModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = extraMediaEventModel.h; sourceTree = "<group>"; };
@@ -2950,6 +2956,15 @@
 			path = uploadFileManager;
 			sourceTree = "<group>";
 		};
+		6B1774EF2D8CFF8B001082D9 /* DocumentPickerManager */ = {
+			isa = PBXGroup;
+			children = (
+				6B1774F02D8D003E001082D9 /* DocumentPickerManager.h */,
+				6B1774F12D8D003E001082D9 /* DocumentPickerManager.m */,
+			);
+			path = DocumentPickerManager;
+			sourceTree = "<group>";
+		};
 		6B1B0AE02D1AA1960044FC55 /* webRtcPingManager */ = {
 			isa = PBXGroup;
 			children = (
@@ -3375,6 +3390,7 @@
 		6B5D86632C227C4A008D25EA /* NAS */ = {
 			isa = PBXGroup;
 			children = (
+				6B1774EF2D8CFF8B001082D9 /* DocumentPickerManager */,
 				6B61F58A2D890E3100C01A8A /* appToTVManager */,
 				6B5ECC902D76FADD0069CB86 /* search */,
 				6BDB85B42D572FDC00526D1F /* BoxHeartbeatAlertTool */,
@@ -4180,6 +4196,7 @@
 				6B0582782AFF7C6D00D37290 /* TZAssetModel+imageData.h in Headers */,
 				6BDB85BF2D57444400526D1F /* BoxHeartbeatReStartSucView.h in Headers */,
 				6B8661DD2BBA578600B19846 /* HaveNoticeView.h in Headers */,
+				6B1774F52D8D003E001082D9 /* DocumentPickerManager.h in Headers */,
 				6B5D403F2B4CE40F000965CF /* downloadManager.h in Headers */,
 				6B679DF02C252ED000D0DC03 /* NASMySpaceTableViewCell.h in Headers */,
 				6B5D40372B4BEEF8000965CF /* downloadThumbnailManager.h in Headers */,
@@ -4490,6 +4507,7 @@
 				6BD506A52B9576A4006E7CB0 /* TZAssetModel+imageData.h in Headers */,
 				6BDB85BD2D57444400526D1F /* BoxHeartbeatReStartSucView.h in Headers */,
 				6B8661DE2BBA578600B19846 /* HaveNoticeView.h in Headers */,
+				6B1774F32D8D003E001082D9 /* DocumentPickerManager.h in Headers */,
 				6BD506A62B9576A4006E7CB0 /* downloadManager.h in Headers */,
 				6B679DF22C252ED000D0DC03 /* NASMySpaceTableViewCell.h in Headers */,
 				6BD506A72B9576A4006E7CB0 /* downloadThumbnailManager.h in Headers */,
@@ -5071,6 +5089,7 @@
 				6BD507272B9576A4006E7CB0 /* AJPhotoListView.m in Sources */,
 				6B2C1E592C070ADE00FDCF82 /* UIScrollView+ZFPlayer.m in Sources */,
 				6BECEE652D8AC1D900CEC9A5 /* searchListModel.m in Sources */,
+				6B1774F22D8D003E001082D9 /* DocumentPickerManager.m in Sources */,
 				6BD507282B9576A4006E7CB0 /* PwdInPutView.m in Sources */,
 				6B3AD68C2BF4AE630096D6B7 /* backupsOptionViewController.m in Sources */,
 				6B2C1EAB2C070ADE00FDCF82 /* ZFReachabilityManager.m in Sources */,
@@ -5463,6 +5482,7 @@
 				6B05819E2AFCF4E800D37290 /* AJPhotoListView.m in Sources */,
 				6B2C1E582C070ADE00FDCF82 /* UIScrollView+ZFPlayer.m in Sources */,
 				6BECEE632D8AC1D900CEC9A5 /* searchListModel.m in Sources */,
+				6B1774F42D8D003E001082D9 /* DocumentPickerManager.m in Sources */,
 				18E557292A3C60ED005CC84B /* PwdInPutView.m in Sources */,
 				6B3AD68B2BF4AE630096D6B7 /* backupsOptionViewController.m in Sources */,
 				6B2C1EAA2C070ADE00FDCF82 /* ZFReachabilityManager.m in Sources */,