|
|
@@ -52,6 +52,8 @@
|
|
|
/** 添加要上传的 模型 */
|
|
|
- (void)addDownloadWithModels:(NSArray *)fileModels{
|
|
|
|
|
|
+ HLog(@"添加任务-- %ld",fileModels.count)
|
|
|
+
|
|
|
for (uploadFileDataModel *model in fileModels) {
|
|
|
BOOL needAddType = YES;
|
|
|
|
|
|
@@ -354,7 +356,11 @@
|
|
|
#pragma mark 视频上传
|
|
|
- (void)beginUploadVideoDataFunBy:(customUploadOperation*)operation with:(NSInteger)position withPara:(NSMutableDictionary*)paraDict success:(netWork_Success)success faild:(netWork_Faild)faildStr
|
|
|
{
|
|
|
-
|
|
|
+ if(operation.isCancelType){
|
|
|
+ HLog(@"防止取消不了任务生效")
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
BOOL isLastPicece = NO;
|
|
|
if((operation.fileModel.totalBytes - position) <= MaxNasUploadPieceSzie){
|
|
|
[paraDict setObject:@"true" forKey:@"isLast"];
|
|
|
@@ -762,7 +768,7 @@ didReceiveResponse:(NSURLResponse *)response
|
|
|
#pragma mark 取消单个任务
|
|
|
- (void)cancelUploadTaskFunWith:(uploadFileDataModel*)fileModel
|
|
|
{
|
|
|
-
|
|
|
+ HLog(@"取消任务-- %@--%@",fileModel.filename,fileModel.taskId)
|
|
|
@synchronized (self) {
|
|
|
for (uploadFileDataModel*waitModel in _uploadWaitingUrlArr) {
|
|
|
if([waitModel.filename isEqualToString:fileModel.filename]){
|
|
|
@@ -773,6 +779,7 @@ didReceiveResponse:(NSURLResponse *)response
|
|
|
|
|
|
for (customUploadOperation*operation in _uploadingOperationArr) {
|
|
|
if([operation.fileModel.filename isEqualToString:fileModel.filename]){
|
|
|
+ operation.isCancelType = YES;
|
|
|
[operation.dataTask cancel];
|
|
|
[_uploadingOperationArr removeObject:operation];
|
|
|
[self beginUpload];
|
|
|
@@ -786,10 +793,12 @@ didReceiveResponse:(NSURLResponse *)response
|
|
|
#pragma mark 取消所有任务
|
|
|
- (void)cancelUploadAllTaskFun
|
|
|
{
|
|
|
+ HLog(@"取消所有任务")
|
|
|
@synchronized (self) {
|
|
|
[_uploadWaitingUrlArr removeAllObjects];
|
|
|
|
|
|
for (customUploadOperation*operation in _uploadingOperationArr) {
|
|
|
+ operation.isCancelType = YES;
|
|
|
[operation.dataTask cancel];
|
|
|
}
|
|
|
|