Home  >  Article  >  Backend Development  >  Use YKTNetwork to make network requests, continuously publish task network POST requests, and continuously publish multiple tasks, causing delays.

Use YKTNetwork to make network requests, continuously publish task network POST requests, and continuously publish multiple tasks, causing delays.

WBOY
WBOYOriginal
2016-09-28 08:38:231418browse

This is a click event of the release task button. create inherits YKTBaseNetwork, similar to the model. God guide me

<code>- (void)addTaskClickAndFaBu
{
  

    //收回键盘
     [self.taskConTextView resignFirstResponder];
    
    [self getCurentNetwork];
    
    
    NSString *t_taskContent=[NSString stringWithFormat:@"%@",[resutlDict valueForKey:@"neirong"]];
    NSString *t_time_id=@"";//d(1今天截止2明天截止3本周截止4持续推进)
    NSString *timeID=[NSString stringWithFormat:@"%@",[resutlDict valueForKey:@"jiezhiriqi"]];
    if ([timeID isEqualToString:@"今天截止"]) {
        t_time_id=@"1";
    }
    else if ([timeID isEqualToString:@"明天截止"]) {
        t_time_id=@"2";
    }
    else if ([timeID isEqualToString:@"本周截止"]) {
        t_time_id=@"3";
    }
    else if ([timeID isEqualToString:@"持续推进"]) {
        t_time_id=@"4";
    }
    else{
        t_time_id = @"1";
    }
    
    NSString *remind_time=[NSString stringWithFormat:@"%@",[resutlDict valueForKey:@"tishishijian"]];
    
    
    NSString *projectid = [NSString stringWithFormat:@"%@",[resutlDict valueForKey:@"xiangmuID"]];
    
    if ([projectid isEqualToString:@"(null)"]) {
        
        t_projectId =@"";
    }else
    {
        t_projectId=[NSString stringWithFormat:@"%@",projectid];
    }
    
    NSString *xiangmuboardID = [NSString stringWithFormat:@"%@",[resutlDict valueForKey:@"xiangmuboardID"]];
    
    NSString *member=[NSString stringWithFormat:@"%@",[resutlDict valueForKey:@"tongshiID"]];
    
    CreateNewTaskAPI *create = [CreateNewTaskAPI new];
    create.t_taskContent = t_taskContent;
    create.t_time_id = t_time_id;
    
    if (![remind_time isEqualToString:@""]) {
        //提醒时间
       create.remind_time = remind_time;
    }
    
    //项目小组id
    if (![t_projectId isEqualToString:@""]) {
        
         create.t_projectId = t_projectId;
    }
    //敏捷流程面板id
    if (![xiangmuboardID isEqualToString:@""]) {
         create.t_panel_id=xiangmuboardID;
    }
    
    // 任务相关成员id(多个成员用逗号隔开)
    if (![member isEqualToString:@""]) {
        
        create.member=member;

    }
//    dispatch_queue_t aQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
//
//    dispatch_async(aQueue, ^{
//        
//        
//        
//    });
//    
//    
    [create startWithCompletionBlockWithSuccess:^(YTKBaseRequest *request) {
        
        NSLog(@"++++++++++++++%@",request.responseJSONObject);
      
        if(request.responseJSONObject){
            
            TaskModel *model=[TaskModel mj_objectWithKeyValues:request.responseJSONObject];
            NSLog(@"%@",model.status);
            if (model.status) {
                
//                [HUDView showWithOnlyText:@"发布失败"];
            }
            else{
                
                
                if (self.taskcontent) {
                    //返回聊天界面
                    [self.navigationController popViewControllerAnimated:YES];
                }
                else{
                
//                    跳转到详情界面
                    WTaskDetailViewController * taskDetailViewController = [[WTaskDetailViewController alloc] init];
                    
                    taskDetailViewController.hidesBottomBarWhenPushed = YES;
                    taskDetailViewController.task = model;
                    
                    taskDetailViewController.orderBy=self.orderBy;
                    taskDetailViewController.isFromListOrCreate = 2;
                    
                    [self.navigationController pushViewController:taskDetailViewController animated:YES];
                
                }

               }
            
        }
        else{
            
            
//            [HUDView showWithOnlyText:@"发布失败"];
            [HUDView hide];

        }

        
    } failure:^(YTKBaseRequest *request) {
        
//        [HUDView showWithOnlyText:@"发布失败"];
        [HUDView hide];
    }];
    
</code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:ajax return value problemNext article:ajax return value problem