Forráskód Böngészése

Merge branch 'Private-X_1.4.3_nas' into Private-X_1.4.2_webrtc

huangxiaodong 9 hónapja%!(EXTRA string=óta)
szülő
commit
a552d65951

+ 1 - 1
创维盒子/双子星云手机/AppDelegate/PrefixHeader.pch

@@ -124,7 +124,7 @@ isBangsScreen; \
 #define EachPieceSzie (2*1024*1024) //每片上传文件大小切割
 #define cutVideoPieceSzie (3 * EachPieceSzie) //视频每次切片多少(切完上传再切一次)
 
-#define MaxNasUploadPieceSzie (10*1024*1024) //frp上传 限制每片最大xx M
+#define MaxNasUploadPieceSzie (50*1024*1024) //frp上传 限制每片最大xx M
 #define keyToForgetPwd @"%==%"
 
 #define FileService            @"http://file.phone.androidscloud.com:8210/document/file/lowLevelMultipartUpload"

+ 9 - 6
创维盒子/双子星云手机/Class/Set/uploadFile/customDownloadManager/customDownloadManager.m

@@ -488,16 +488,19 @@ totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend {
     [[NSNotificationCenter defaultCenter] postNotificationName:customDownloadTaskExeError object:nil userInfo:@{@"operation" : operation}];
 }
 
-//外面的下载数据跳的太频繁 控制下
-static int DownloadTaskExeingNotNum = 0;
-
 // 重启某一个operation 保存本地 通知外界
 - (void)operationDoningWithOperation:(customDownloadOperation *)operation {
     HLog(@"DownloadTaskExeing");
     
-    DownloadTaskExeingNotNum ++;
-    if (DownloadTaskExeingNotNum >= 10) {
-        DownloadTaskExeingNotNum = 0;
+    NSTimeInterval curTime = [[NSDate date] timeIntervalSince1970];
+    NSTimeInterval timeDiff = curTime - operation.preNotTimeInterval;
+    
+    HLog(@"控制刷新时间为1秒:%f",timeDiff);
+    
+    if (operation.preNotTimeInterval <= 0
+        || timeDiff > 0.8 ) {
+        
+        operation.preNotTimeInterval = curTime;
         [[NSNotificationCenter defaultCenter] postNotificationName:customDownloadTaskExeing object:nil userInfo:@{@"operation" : operation}];
     }
 }

+ 3 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/customDownloadManager/customDownloadOperation.h

@@ -63,6 +63,9 @@ NS_ASSUME_NONNULL_BEGIN
 /** 是否完成 */
 @property (nonatomic, assign)  NSInteger isFinished;
 
+/** 下载中上次通知的时间  用来控制通知时间的频率 目前定位一秒 */
+@property (nonatomic, assign) NSTimeInterval  preNotTimeInterval;
+
 // 创建下载操作任务
 - (instancetype)initWith:(NSString *)url session:(NSURLSession *)session;
 // downloadType 不传 即为原来的 分享链接唤起的下载

+ 2 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/photoView/uploadFileBottomView.h

@@ -22,6 +22,8 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic,copy) void (^didClickbottomFun)(void);
 
 - (void)setSavePathDataFun;
+//上传按钮是否可以交互
+- (void)setUploadButtonCanClickFunBy:(BOOL)canClick;
 @end
 
 NS_ASSUME_NONNULL_END

+ 16 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/photoView/uploadFileBottomView.m

@@ -199,6 +199,22 @@
     }
     
     if(_indexPathsForSelectedItems.count > 0 && isCanUpload){
+//        self.uploadButon.enabled = YES;
+//        self.uploadButon.alpha = 1;
+    }
+    else
+    {
+        self.uploadButon.enabled = NO;
+        self.uploadButon.alpha = 0.5;
+    }
+}
+
+//上传按钮是否可以交互
+- (void)setUploadButtonCanClickFunBy:(BOOL)canClick
+{
+    //if(canClick && _isExtraFileAndNotFindPathType)
+    if(canClick)
+    {
         self.uploadButon.enabled = YES;
         self.uploadButon.alpha = 1;
     }

+ 1 - 1
创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileView/downloadFileRecordCell.m

@@ -538,7 +538,7 @@
     
     KWeakSelf
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-        [weakSelf updateDataDownloadingBy:_curCouldPhoneFileModel];
+        [weakSelf updateDataDownloadingBy:self->_curCouldPhoneFileModel];
     });
 }
 

+ 10 - 1
创维盒子/双子星云手机/Class/Set/uploadFile/uploadImageOrVideoViewController.m

@@ -501,7 +501,7 @@
     }
     else
     {//选中
-        [self didSelectModel:model isLastModel:NO];
+        [self didSelectModel:model isLastModel:YES];
         [cell isSelected:YES];
     }
     
@@ -529,6 +529,7 @@
             if(isLast){
                 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                     [SVProgressHUD dismiss];
+                    [self.uploadFileBottomV setUploadButtonCanClickFunBy:YES];
                 });
             }
         }];
@@ -557,6 +558,7 @@
                 if(isLast){
                     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                         [SVProgressHUD dismiss];
+                        [self.uploadFileBottomV setUploadButtonCanClickFunBy:YES];
                     });
                 }
                 
@@ -569,6 +571,7 @@
         if(isLast){
             dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                 [SVProgressHUD dismiss];
+                [self.uploadFileBottomV setUploadButtonCanClickFunBy:YES];
             });
         }
     }
@@ -708,6 +711,12 @@
     [self delayedSetPhotoGroupViewFrameFun];
 }
 
+- (void)viewWillDisappear:(BOOL)animated
+{
+    [super viewWillDisappear:animated];
+    [SVProgressHUD dismiss];
+}
+
 - (void)showUploadTipFun
 {
     BOOL didReadUploadTipType = [HWDataManager getBoolWithKey:Const_file_upLoad_need_read];

+ 5 - 1
创维盒子/双子星云手机/NAS/nasBackupsManager/nasMixBackupsManager.m

@@ -289,7 +289,11 @@
         [self startUpload:paraDict operation:operation data:curData success:^(id  _Nonnull responseObject) {
             frpUploadModel *model = [[frpUploadModel alloc] initWithDictionary:responseObject error:nil];
             if(model && model.position == operation.fileModel.totalBytes){
-                HLog(@"%@上传完成 000",operation.fileModel.filename)
+                HLog(@"%@上传完成 数据正常",operation.fileModel.filename)
+                [weakSelf handleUploadDoneOneFileBy:operation];
+            }
+            else if(model && model.position > operation.fileModel.totalBytes){
+                HLog(@"%@上传完成 数据异常 -- position:%ld -- totalBytes:%ld",operation.fileModel.filename,model.position,operation.fileModel.totalBytes)
                 [weakSelf handleUploadDoneOneFileBy:operation];
             }
             else{

+ 11 - 6
创维盒子/双子星云手机/NAS/nasDownloadManager/nasDownloadManager.m

@@ -411,7 +411,7 @@ totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend {
     
     // 获得已经下载的文件大小
     operation.currentSize += data.length;
-    HLog(@"currentSize:%lld---progress:%.2f", operation.currentSize, 1.00*operation.currentSize/operation.totalSize);
+    HLog(@"当前线程:%@ -----currentSize:%lld---progress:%.2f",[NSThread currentThread], operation.currentSize, 1.00*operation.currentSize/operation.totalSize);
 
     // 写入文件
     if(operation.handle){
@@ -488,16 +488,21 @@ totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend {
     [[NSNotificationCenter defaultCenter] postNotificationName:nasDownloadTaskExeError object:nil userInfo:@{@"operation" : operation}];
 }
 
-//外面的下载数据跳的太频繁 控制下
-static int nasDownloadTaskExeingNotNum = 0;
+
 
 // 重启某一个operation 保存本地 通知外界
 - (void)operationDoningWithOperation:(customDownloadOperation *)operation {
     HLog(@"DownloadTaskExeing");
     
-    nasDownloadTaskExeingNotNum ++;
-    if (nasDownloadTaskExeingNotNum >= 30) {
-        nasDownloadTaskExeingNotNum = 0;
+    NSTimeInterval curTime = [[NSDate date] timeIntervalSince1970];
+    NSTimeInterval timeDiff = curTime - operation.preNotTimeInterval;
+    
+    HLog(@"控制刷新时间为1秒:%f",timeDiff);
+    
+    if (operation.preNotTimeInterval <= 0
+        || timeDiff > 0.8 ) {
+        
+        operation.preNotTimeInterval = curTime;
         [[NSNotificationCenter defaultCenter] postNotificationName:nasDownloadTaskExeing object:nil userInfo:@{@"operation" : operation}];
     }
 }

+ 4 - 0
创维盒子/双子星云手机/NAS/nasUploadManager/customUploadOperation.h

@@ -30,6 +30,10 @@ NS_ASSUME_NONNULL_BEGIN
 @property(nonatomic,assign) NSInteger  i;//从来控制速度刷新的
 
 @property(nonatomic,assign) BOOL  isCancelType;//是都被点击暂停或者删除了(考虑dataTask取消的情况)
+
+/** 下载中上次通知的时间  用来控制通知时间的频率 目前定位一秒 */
+@property (nonatomic, assign) NSTimeInterval  preNotTimeInterval;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 154 - 106
创维盒子/双子星云手机/NAS/nasUploadManager/nasMixUploadManager.m

@@ -19,7 +19,7 @@
 //正在下载的上传地址数组
 @property(nonatomic,strong) NSMutableArray *uploadingOperationArr;
 
-@property(nonatomic,assign) NSInteger speedShowCount;//内网的情况 多少次才刷新一次
+@property(nonatomic,strong)NSLock  *arrayLock;//数组遍历是修改会挂掉
 @end
 
 @implementation nasMixUploadManager
@@ -37,13 +37,7 @@
     if (self = [super init]) {
         _maxUploadLoadCount = 2;
         
-       if ([pingManager shareManager].isPingOk)
-       {
-           _speedShowCount = 3;
-       }
-       else{
-           _speedShowCount = 0;
-       }
+        _arrayLock = [NSLock new];
         //[self registeNotification];
     }
     return self;
@@ -79,12 +73,13 @@
     }
     
     //启动上传
-    [self beginUpload];
+    [self beginUploadAfterDeleteOperationBy:nil];
 }
 
 //在添加XX后 启动下载
-- (void)beginUpload
+- (void)beginUploadAfterDeleteOperationBy:(customUploadOperation*)operation
 {
+    HLog(@"beginUploadAfterDeleteOperationBy")
     BOOL isCanUseCellular = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_canUse_Cellular_all)];
     if(!isCanUseCellular){//不允许流量上传
         //
@@ -108,41 +103,50 @@
         return;
     }
     
-    @synchronized (self) {
-        if(self.uploadingOperationArr.count == _maxUploadLoadCount){
-            HLog(@"正在上传的数量达到了最大值 %ld",_maxUploadLoadCount)
-            return;
-        }
-        
-        if(self.uploadWaitingUrlArr.count == 0){
-            HLog(@"没有等待中的上传任务")
-            return;
-        }
-        
-        NSInteger canAddTaskNumber = _maxUploadLoadCount - self.uploadingOperationArr.count;
+    
+    if(operation){
+        HLog(@"删除完成的上传任务")
+        [_arrayLock lock];
+        [self.uploadingOperationArr removeObject:operation];
+        [_arrayLock unlock];
+    }
+    
+    if(self.uploadingOperationArr.count == _maxUploadLoadCount){
+        HLog(@"正在上传的数量达到了最大值 %ld",_maxUploadLoadCount)
+        return;
+    }
+    
+    if(self.uploadWaitingUrlArr.count == 0){
+        HLog(@"没有等待中的上传任务")
+        return;
+    }
+    
+    NSInteger canAddTaskNumber = _maxUploadLoadCount - self.uploadingOperationArr.count;
+    
+    [_arrayLock lock];
+    for (int i=0; i<canAddTaskNumber; i++) {
         
-        for (int i=0; i<canAddTaskNumber; i++) {
+        if(self.uploadWaitingUrlArr.count >= 1){
+            //创建上传任务
+            uploadFileDataModel *WaitingModel = self.uploadWaitingUrlArr.firstObject;
             
-            if(self.uploadWaitingUrlArr.count >= 1){
-                //创建上传任务
-                uploadFileDataModel *WaitingModel = self.uploadWaitingUrlArr.firstObject;
-                
-                __block customUploadOperation * operation =  [customUploadOperation new];
-                operation.fileModel = WaitingModel;
-                
-                //等待下载中的任务
-                [self.uploadWaitingUrlArr removeObjectAtIndex:0];
-                //添加到下载中数组
-                [self.uploadingOperationArr addObject:operation];
-                
-                [self checkFileUploadStateWithOperation:operation];
-                
-                //[weakSelf handleTaskDidUploadWith:operation withState:state];
-            }
+            __block customUploadOperation * operation =  [customUploadOperation new];
+            operation.fileModel = WaitingModel;
+            
+            //等待下载中的任务
+            [self.uploadWaitingUrlArr removeObjectAtIndex:0];
+            
+            HLog(@"添加一个新的上传任务")
+            //添加到下载中数组
+            [self.uploadingOperationArr addObject:operation];
             
+            [self checkFileUploadStateWithOperation:operation];
+            
+            //[weakSelf handleTaskDidUploadWith:operation withState:state];
         }
-    
+        
     }
+    [_arrayLock unlock];
     
 }
 
@@ -167,11 +171,12 @@
             [weakSelf checkFileUploadStateFunAfterNetWith:model WithOperation:operation];
         }
         else{
-            //FileExistRet(-1);
+            HLog(@"isFileExist接口异常:%@",responseObject)
+            [weakSelf handleUploadFailOneFileBy:operation];
         }
     } failure:^(NSError * _Nonnull error) {
         HLog(@"%@",error)
-        //FileExistRet(-1);
+        [weakSelf handleUploadFailOneFileBy:operation];
     }];
     
 }
@@ -180,6 +185,7 @@
 - (void)checkFileUploadStateFunAfterNetWith:(frpFileExistModel*)model WithOperation:(customUploadOperation*)operation
 {
     if(!model){
+        [self handleUploadFailOneFileBy:operation];
         return;
     }
     
@@ -193,18 +199,7 @@
     else if(model.data.isComplete){//上传过了 并且文件上传完了
         //判断下文件创建长度是否一致 一致则是上传完了 不一致 重新上传一个 可能是同名的文件而已
         if(model.data.size >= operation.fileModel.totalBytes){//上传完了
-            mainBlock(^{
-                [[iToast makeText:NSLocalizedString(@"File_upload_file_already_exists",nil)] show];
-            });
-            
-            NSMutableArray *delArr = [NSMutableArray new];
-            [delArr addObject:operation.fileModel];
-            
-            [[nasUploadFileManager shareInstance] deleteUploadFileRecordBy:delArr withDelCache:YES complete:^(BOOL isSuccess) {
-                if (isSuccess) {
-                    
-                }
-            }];
+            [self handleFileDidUploadFunWithOperation:operation];
         }
         else{//未上传完 isComplete 这个字段有问题
             operation.fileModel.didUploadBytes = model.data.size;
@@ -219,7 +214,22 @@
 }
 
 
-#pragma mark 处理任务失败
+#pragma mark 任务上传过了了
+- (void)handleFileDidUploadFunWithOperation:(customUploadOperation*)operation
+{
+    mainBlock(^{
+        [[iToast makeText:NSLocalizedString(@"File_upload_file_already_exists",nil)] show];
+    });
+    
+    NSMutableArray *delArr = [NSMutableArray new];
+    [delArr addObject:operation.fileModel];
+    
+    [[nasUploadFileManager shareInstance] deleteUploadFileRecordBy:delArr withDelCache:YES complete:^(BOOL isSuccess) {
+        if (isSuccess) {
+            
+        }
+    }];
+}
 
 
 #pragma mark 准备上传文件
@@ -241,6 +251,7 @@
     }
     else{
         HLog(@"获取保存路径失败")
+        [self handleUploadFailOneFileBy:operation];
         return;
     }
     
@@ -261,6 +272,16 @@
             NSString*pathStr = [cachesFileManager getFilePathWithName:operation.fileModel.filename type:operation.fileModel.curUploadFileType];
             NSData *imageData = [NSData dataWithContentsOfFile:pathStr];
             
+            //修复出现过 图片数据小于totalBytes
+            if(imageData){
+                long curDataLengt = [imageData length];
+                if(curDataLengt == operation.fileModel.didUploadBytes && curDataLengt < operation.fileModel.totalBytes){
+                    HLog(@"totalBytes 获取出错?")
+                    [self handleFileDidUploadFunWithOperation:operation];
+                    return;
+                }
+            }
+            
             if (!imageData) {
                 
                 if(!operation.fileModel.asset){
@@ -274,9 +295,13 @@
                         // 直接得到最终的 NSData 数据
                         if (imageData) {
                             operation.fileModel.imageData = imageData;
+                            if(operation.fileModel.totalBytes == 0){
+                                operation.fileModel.totalBytes = [imageData length];
+                            }
                             [weakSelf  afterGetImageDataFunWithOperation:operation];
                         }
                         else{
+                            HLog(@"\n\n\n\nrequestImageDataForAsset fail imageData nil\n\n\n")
                             [weakSelf handleUploadFailOneFileBy:operation];
                         }
                 }];
@@ -290,6 +315,10 @@
         NSData *curData = operation.fileModel.imageData;
         operation.onceDataLengt = [curData length];
         
+        if(operation.fileModel.totalBytes == 0){//异常处理
+            operation.fileModel.totalBytes = operation.onceDataLengt;
+        }
+        
         [self startUpload:paraDict operation:operation data:curData success:^(id  _Nonnull responseObject) {
             frpUploadModel *model = [[frpUploadModel alloc] initWithDictionary:responseObject error:nil];
             if(model && model.position == operation.fileModel.totalBytes){
@@ -297,7 +326,8 @@
                 [weakSelf handleUploadDoneOneFileBy:operation];
             }
             else{
-                HLog(@"%@上传完成一片 %ld",operation.fileModel.filename,model.position)
+                HLog(@"%@上传完成异常 %ld---%ld",operation.fileModel.filename,model.position,operation.fileModel.totalBytes)
+                [weakSelf handleUploadDoneOneFileBy:operation];
             }
         } faild:^(NSError * _Nonnull error) {
             HLog(@"%@上传失败",operation.fileModel.filename)
@@ -386,7 +416,7 @@
     [self startUpload:paraDict operation:operation data:videoData success:^(id  _Nonnull responseObject) {
         frpUploadModel *model = [[frpUploadModel alloc] initWithDictionary:responseObject error:nil];
         if(model && model.position >= operation.fileModel.totalBytes){
-            HLog(@"%@上传完成 000",operation.fileModel.filename)
+            HLog(@"%@上传完成 001",operation.fileModel.filename)
             [weakSelf handleUploadDoneOneFileBy:operation];
         }
         else{
@@ -411,6 +441,8 @@
 
 #pragma mark 分段读视频文件
 -(NSData*)cutVideoFileFunAtIndex:(NSUInteger)dataIndex withMaxLenght:(NSInteger)maxLengt withModel:(uploadFileDataModel*)dataModel{
+    HLog(@"视频切片开始 线程:%@",[NSThread currentThread]);
+    
     NSString *filePath = [cachesFileManager getFilePathWithName:dataModel.filename type:uploadFileTypeVideo]; // 文件路径
     
     NSFileManager *manager0 = [NSFileManager defaultManager];
@@ -475,9 +507,9 @@
 #pragma mark 处理上传完成
 - (void)handleUploadDoneOneFileBy:(customUploadOperation*)operation
 {
+    HLog(@"handleUploadDoneOneFileBy")
     [[NSNotificationCenter defaultCenter] postNotificationName:nasUploadTaskExeEnd object:operation.fileModel];
-    [_uploadingOperationArr removeObject:operation];
-    [self beginUpload];
+    [self beginUploadAfterDeleteOperationBy:operation];
 }
 
 #pragma mark 处理删除失败
@@ -485,8 +517,7 @@
 {
     operation.fileModel.curUploadStateType = uploadStateFail;
     [[NSNotificationCenter defaultCenter] postNotificationName:nasUploadTaskExeError object:operation.fileModel];
-    [_uploadingOperationArr removeObject:operation];
-    [self beginUpload];
+    [self beginUploadAfterDeleteOperationBy:operation];
 }
 
 #pragma mark 根据 asset 获取到图片数据
@@ -687,7 +718,7 @@
         }
     }];
     
-    [self beginUpload];
+    [self beginUploadAfterDeleteOperationBy:nil];
 }
     
 
@@ -743,67 +774,84 @@ didReceiveResponse:(NSURLResponse *)response
     // 32768 = 32KB
     HLog(@"didSendBodyData: %lld--%lld-%lld", bytesSent, totalBytesSent, totalBytesExpectedToSend);
     
-    
-    for (customUploadOperation*operation in _uploadingOperationArr) {
-        if(operation.dataTask == task){
-            operation.fileModel.didUploadBytes += bytesSent;
-            
-            //调整下大小 因为上传的数据 除了data 长度 还包含了 参数大小
-            if(totalBytesSent == totalBytesExpectedToSend){
-                operation.fileModel.didUploadBytes -= (totalBytesExpectedToSend - operation.onceDataLengt);
-            }
-            
-            operation.i ++;
-            if(operation.i >= _speedShowCount){
-                [[NSNotificationCenter defaultCenter] postNotificationName:uploadFileRefreshNotification object:operation.fileModel];
-                operation.i = 0;
-            }
-            
-            break;
-        }
-    }
-    
+    //最后一片数据不刷新
+//    if(totalBytesSent == totalBytesExpectedToSend){
+//        return;
+//    }
+    
+    
+//    [_arrayLock lock];
+//    for (customUploadOperation*operation in _uploadingOperationArr) {
+//        if(operation.dataTask == task){
+//            operation.fileModel.didUploadBytes += bytesSent;
+//            
+//            //调整下大小 因为上传的数据 除了data 长度 还包含了 参数大小
+//            if(totalBytesSent == totalBytesExpectedToSend){
+//                operation.fileModel.didUploadBytes -= (totalBytesExpectedToSend - operation.onceDataLengt);
+//            }
+//            
+//            NSTimeInterval curTime = [[NSDate date] timeIntervalSince1970];
+//            NSTimeInterval timeDiff = curTime - operation.preNotTimeInterval;
+//            
+//            //HLog(@"控制刷新时间为1秒:%f",timeDiff);
+//            
+//            if (operation.preNotTimeInterval <= 0
+//                || timeDiff > 0.8 ) {
+//                
+//                operation.preNotTimeInterval = curTime;
+//                [[NSNotificationCenter defaultCenter] postNotificationName:uploadFileRefreshNotification object:operation.fileModel];
+//            }
+//            
+//            break;
+//        }
+//    }
+//    [_arrayLock unlock];
 }
 
 #pragma mark 取消单个任务
 - (void)cancelUploadTaskFunWith:(uploadFileDataModel*)fileModel
 {
     HLog(@"取消任务-- %@--%@",fileModel.filename,fileModel.taskId)
-    @synchronized (self) {
-        for (uploadFileDataModel*waitModel in _uploadWaitingUrlArr) {
-            if([waitModel.filename isEqualToString:fileModel.filename]){
-                [_uploadWaitingUrlArr removeObject:waitModel];
-                return;
-            }
+    
+    [_arrayLock lock];
+    
+    for (customUploadOperation*operation in _uploadingOperationArr) {
+        if([operation.fileModel.filename isEqualToString:fileModel.filename]){
+            operation.isCancelType = YES;
+            [operation.dataTask cancel];
+            [_arrayLock unlock];
+            [self beginUploadAfterDeleteOperationBy:operation];
+            return;
         }
-        
-        for (customUploadOperation*operation in _uploadingOperationArr) {
-            if([operation.fileModel.filename isEqualToString:fileModel.filename]){
-                operation.isCancelType = YES;
-                [operation.dataTask cancel];
-                [_uploadingOperationArr removeObject:operation];
-                [self beginUpload];
-                break;
-            }
+    }
+    
+    for (uploadFileDataModel*waitModel in _uploadWaitingUrlArr) {
+        if([waitModel.filename isEqualToString:fileModel.filename]){
+            [_uploadWaitingUrlArr removeObject:waitModel];
+            [_arrayLock lock];
+            [self beginUploadAfterDeleteOperationBy:nil];
+            return;
         }
     }
     
+    [_arrayLock unlock];
+    
 }
 
 #pragma mark 取消所有任务
 - (void)cancelUploadAllTaskFun
 {
     HLog(@"取消所有任务")
-    @synchronized (self) {
-        [_uploadWaitingUrlArr removeAllObjects];
-        
-        for (customUploadOperation*operation in _uploadingOperationArr) {
-            operation.isCancelType = YES;
-            [operation.dataTask cancel];
-        }
-        
-        [_uploadingOperationArr removeAllObjects];
+    [_arrayLock lock];
+    [_uploadWaitingUrlArr removeAllObjects];
+    
+    for (customUploadOperation*operation in _uploadingOperationArr) {
+        operation.isCancelType = YES;
+        [operation.dataTask cancel];
     }
+    
+    [_uploadingOperationArr removeAllObjects];
+    [_arrayLock unlock];
 }
 
 

+ 8 - 3
创维盒子/双子星云手机/NAS/nasUploadManager/nasUploadFileManager.m

@@ -51,7 +51,9 @@
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), ^{
 //        NSLock *lock = [NSLock new];
 //        [lock lock];
+        HLog(@"begin bg_findAsync");
         [uploadFileDataModel bg_findAsync:nasUpLoadFile_tableName limit:0 orderBy:nil desc:YES complete:^(NSArray * _Nullable array) {
+            HLog(@"end bg_findAsync");
             NSMutableArray *failArr = [NSMutableArray new];
             NSMutableArray *doneArr = [NSMutableArray new];
             NSMutableArray *otherArr = [NSMutableArray new];
@@ -286,6 +288,8 @@
 #pragma mark 更新数据状态
 - (void)nasUploadFileChangeingOneFileFunBy:(uploadFileDataModel*)dataModel
 {
+    //test code
+    //return;
     
     if(dataModel.curUploadStateType == uploadStateDone){
         [self handleDatabaseArrDeleteObjectInUploading:dataModel];
@@ -314,9 +318,10 @@
     }];
         
     
-    if(!_isSuspendType || dataModel.curUploadStateType != uploadStateSuspend){
-        [[NSNotificationCenter defaultCenter] postNotificationName:uploadFileRefreshNotification object:dataModel];
-    }
+//    if(!_isSuspendType || dataModel.curUploadStateType != uploadStateSuspend){
+//        HLog(@"nasUploadFileChangeingOneFileFunBy uploadFileRefreshNotification")
+//        [[NSNotificationCenter defaultCenter] postNotificationName:uploadFileRefreshNotification object:dataModel];
+//    }
     
 }
 

+ 1 - 1
创维盒子/双子星云手机/netWork/netWorkManager.m

@@ -143,7 +143,7 @@ static netWorkManager *Game_NetWorkShareInstance = nil;
     
     // 设置超时时间(设置有效)
     //[manager.requestSerializer willChangeValueForKey:@"timeoutInterval"];
-    manager.requestSerializer.timeoutInterval = 30;
+    manager.requestSerializer.timeoutInterval = 180;
     //[manager.requestSerializer didChangeValueForKey:@"timeoutInterval"];
     
 }