Parcourir la source

1.下载点击开启和关闭 修改数据可以状态

huangxiaodong il y a 1 an
Parent
commit
414f4ff9ea

+ 4 - 4
创维盒子/双子星云手机/Class/Set/uploadFile/receiveView/boxDownloadFileRecordCell.m

@@ -429,13 +429,13 @@
                 _fileImageView.image = cacheImage;
             }
             else{
-                [_fileImageView sd_setImageWithURL:[NSURL URLWithString:fileUrl] placeholderImage:nil completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
+                [_fileImageView sd_setImageWithURL:[NSURL URLWithString:fileUrl] placeholderImage:defaultImage completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
                     if(image){
                         //HLog(@"11图片1:%@",imageURL.absoluteString);
                     }
                     else{
                         //HLog(@"11图片0:%@",imageURL.absoluteString);
-                        self->_fileImageView.image = defaultImage;
+                        //self->_fileImageView.image = defaultImage;
                     }
                     
                 }];
@@ -454,13 +454,13 @@
                 _fileImageView.image = cacheImage;
             }
             else{
-                [_fileImageView sd_setImageWithURL:[NSURL URLWithString:fileUrl] placeholderImage:nil completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
+                [_fileImageView sd_setImageWithURL:[NSURL URLWithString:fileUrl] placeholderImage:defaultImage completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
                     if(image){
                         //HLog(@"11图片1:%@",imageURL.absoluteString);
                     }
                     else{
                         //HLog(@"11图片0:%@",imageURL.absoluteString);
-                        self->_fileImageView.image = defaultImage;
+                        //self->_fileImageView.image = defaultImage;
                     }
                     
                 }];

+ 1 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/receiveView/receiveDownloadRecordTableView.m

@@ -734,6 +734,7 @@
     
     for (ShareFileDataModel*model in _downloadingArr) {
         if([model.fileUrl isEqualToString:urlString]){
+            //model.downloadBoxStateType = downloadBoxStateDownloadloading;
             model.currentSize = item.downloadedSize;
             model.curTimeInterval = [[NSDate date] timeIntervalSince1970];
             break;

+ 19 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileManager/boxDownloadFileManager.m

@@ -501,12 +501,31 @@ static boxDownloadFileManager * cur_boxDownloadFileShareInstance = nil;
                 [YCDownloadManager resumeDownloadWithItem:item];
             }
         }
+        
+        if (_databaseArr && _databaseArr.count == 3) {
+            NSMutableArray *downloadingArr = _databaseArr[0];
+            for (ShareFileDataModel*model in downloadingArr) {
+                model.downloadBoxStateType = downloadBoxStateDownloadloading;
+            }
+            
+            if(downloadingArr.count > 0){
+                [ShareFileDataModel bg_updateArrayAsync:downloadingArr complete:^(BOOL isSuccess) {
+                                
+                }];
+            }
+        }
     }
     else{
         
         ShareFileDataModel* dataModel = nil;
         if(arr && arr.count > 0){
             dataModel = arr.firstObject;
+            
+            //修改数据库状态
+            dataModel.downloadBoxStateType = downloadBoxStateDownloadloading;
+            [ShareFileDataModel bg_updateArrayAsync:@[dataModel] complete:^(BOOL isSuccess) {
+                            
+            }];
         }else{
             return;
         }