Files
yuyin_ios/SweetParty/主类/Mine/Controller/SPInviteFriendListVC.m
2025-08-08 11:05:33 +08:00

109 lines
3.0 KiB
Objective-C
Executable File

//
// SPInviteFriendListVC.m
// SweetParty
//
// Created by bj_szd on 2023/1/11.
//
#import "SPInviteFriendListVC.h"
#import "SPInviteFriendListCell.h"
@interface SPInviteFriendListVC ()
@property (weak, nonatomic) IBOutlet UILabel *totalValueLab;
@end
@implementation SPInviteFriendListVC
- (void)viewDidLoad {
[super viewDidLoad];
[self showNaviBarWithTitle:@"邀请列表"];
[self createUI];
[self fetchData];
}
-(void)createUI {
[self.tableView registerNib:[UINib nibWithNibName:@"SPInviteFriendListCell" bundle:nil] forCellReuseIdentifier:@"SPInviteFriendListCell"];
self.tableView.rowHeight = 75;
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(yb_NavigationBar_H);
make.left.right.mas_equalTo(0);
make.bottom.mas_equalTo(-70);
}];
[self showPullToRefresh];
[self showLoadMoreRefresh];
}
- (void)fetchData {
NSDictionary *params = @{@"page":@(self.page), @"page_limit":@(10)};
[AFNetworkRequset.shared postRequestWithParams:params Path:@"/api/user/get_user_child_list" Loading:NO Hud:NO Success:^(id _Nonnull responseDic) {
if (self.page == 1) {
[self.dataArray removeAllObjects];
[self.tableView reloadData];
}
[self endRefresh];
NSArray *arr = [SPFocusFansModel mj_objectArrayWithKeyValuesArray:responseDic[@"data"][@"list"]];
[self.dataArray addObjectsFromArray:arr];
[self.tableView reloadData];
self.totalValueLab.text = [NSString stringWithFormat:@"总收益:%@钻石", responseDic[@"data"][@"user_total_earnings"]];
if (arr.count > 0) {
[self endFooterRefreshWithMore];
}else {
[self endFooterRefreshWithNoMore];
}
if (self.dataArray.count <= 0) {
[self showNoContentView];
} else {
[self hideNoContentView];
}
} Failure:^(id _Nonnull errorData) {
}];
}
- (void)refreshFetchData {
self.page = 1;
[self fetchData];
}
- (void)fetchMoreData {
self.page ++;
[self fetchData];
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.dataArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
SPInviteFriendListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SPInviteFriendListCell" forIndexPath:indexPath];
cell.selectionStyle = NO;
SPFocusFansModel *model = self.dataArray[indexPath.row];
cell.model = model;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
SPFocusFansModel *model = self.dataArray[indexPath.row];
[UIViewController goUserMainpageWith:model.uid withRid:@""];
}
@end