69 lines
2.1 KiB
Objective-C
69 lines
2.1 KiB
Objective-C
//
|
|
// IfishLiveRecommendListViewController.m
|
|
// CollectionViewTest
|
|
//
|
|
// Created by imac on 17/3/27.
|
|
// Copyright © 2017年 xiang. All rights reserved.
|
|
//
|
|
|
|
#import "IfishLiveRecommendListViewController.h"
|
|
|
|
@interface IfishLiveRecommendListViewController ()
|
|
|
|
@end
|
|
|
|
@implementation IfishLiveRecommendListViewController
|
|
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
// Do any additional setup after loading the view.
|
|
self.listType = IfishKanKanListTypeRecommend;
|
|
[self initDataWithFirst:0 pageSize:10 isRefresh:NO];
|
|
}
|
|
|
|
-(void)initDataWithFirst:(NSInteger)firstResult pageSize:(NSInteger)pageSize isRefresh:(BOOL)isRefres{
|
|
|
|
NSString *orderType = [NSString stringWithFormat:@"%lu",(unsigned long)self.listType];
|
|
__weak typeof (self)weskSelf=self;
|
|
[AFHttpTool ifishGetliveRooms:0 pageSize:20 userId:self.userId orderType:orderType success:^(id response) {
|
|
NSDictionary *reDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
|
|
if ([reDic[@"result"] isEqualToString:@"100"]){
|
|
if (isRefres) {
|
|
[weskSelf.dataArray removeAllObjects];
|
|
}
|
|
|
|
NSArray*roomArr=reDic[@"data"];
|
|
self.total =reDic[@"total"];
|
|
for (NSDictionary *dic in roomArr) {
|
|
IfishKankanListModel *mode=[[IfishKankanListModel alloc] initWithDict:dic];
|
|
[self.dataArray addObject:mode];
|
|
}
|
|
|
|
[self.collectionView reloadData];
|
|
}
|
|
|
|
[weskSelf endRefreshing];
|
|
} failure:^(NSError *err) {
|
|
[weskSelf endRefreshing];
|
|
[self.view makeToast:@"请求异常"];
|
|
}];
|
|
|
|
}
|
|
|
|
- (void)didReceiveMemoryWarning {
|
|
[super didReceiveMemoryWarning];
|
|
// Dispose of any resources that can be recreated.
|
|
}
|
|
|
|
/*
|
|
#pragma mark - Navigation
|
|
|
|
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
|
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
|
// Get the new view controller using [segue destinationViewController].
|
|
// Pass the selected object to the new view controller.
|
|
}
|
|
*/
|
|
|
|
@end
|