Heim >Backend-Entwicklung >PHP-Tutorial >Verwenden Sie YKTNetwork, um Netzwerkanforderungen zu stellen, kontinuierlich POST-Anfragen im Aufgabennetzwerk zu veröffentlichen und kontinuierlich mehrere Aufgaben zu veröffentlichen, was zu Verzögerungen führt.
Dies ist ein Klickereignis der Schaltfläche „Erstellen“ von YKTBaseNetwork, ähnlich dem Modell „Gott führe mich“
<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>