#pragma mark 获取
- (void)qingqiushujuUrl:(NSString *)urlString bodyDic:(NSDictionary *)bodyDic{
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
[manager POST:urlString parameters:bodyDic success:^(AFHTTPRequestOperation *operation, id responseObject){
if (!responseObject) {
return;
}
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:responseObject options:0 error:nil];
_dataArr = [[NSMutableArray alloc] init];
NSDictionary *dictionary = [dic objectForKey:@"data"];
for (NSDictionary *appDic in dictionary) {
[_dataArr addObject:[TeachPlanModel modelWithDic:appDic]];
}
[_tableView reloadData];
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
NSLog(@"数据请求失败");
}];
}
//停止网络请求
[manager.operationQueue cancelAllOperations];