首頁 > 後端開發 > php教程 > 使用YKTNetwork做網路請求,連續發布任務網路POST請求,連續發布多個任務,出現延遲現象

使用YKTNetwork做網路請求,連續發布任務網路POST請求,連續發布多個任務,出現延遲現象

WBOY
發布: 2016-09-28 08:38:23
原創
1443 人瀏覽過

這是一個發布任務按鈕點擊事件,create繼承YKTBaseNetwork,類似模型 大神帶我

<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>
登入後複製
相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板