//根据资讯Id获取评论列表(按照时间倒序获取)
-(void)getCommentListByZiXunId:(UIView *)destView :(NSString*)ziXunID{
[MBProgressHUD showHUDAddedTo:destView animated:YES];
NSString*urlstr=[NSString stringWithFormat:@"%@/comment.json/list/%@",hostUrl,ziXunID];
NSURL*url=[NSURL URLWithString:urlstr];
NSLog(@"getCommentListWithZixunId is running with url: %@",urlstr);
NSURLRequest*request=[NSURLRequest requestWithURL:url];
AFJSONRequestOperation*operation=[AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
[MBProgressHUD hideHUDForView:destView animated:YES];
NSLog(@"获取评论列表 request accessed!");
NSLog(@"getCommentListWithZixunId data =%@",JSON);
[[NSNotificationCenter defaultCenter] postNotificationName:@"S_getCommentListByZiXunIdSucceed" object:JSON];
} failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON) {
NSLog(@"获取评论列表 request failure!");
[MBProgressHUD hideAllHUDsForView:destView animated:YES];
[[NSNotificationCenter defaultCenter]postNotificationName:@"S_getCommentListByZiXunIdFailure" object:JSON];
}];
[operation start];
}
AFJSONRequestOperation 网络请求(get)
最新推荐文章于 2024-08-28 13:39:05 发布