Files
yuyin_ios/SweetParty/主类/Mine/GongHui/SPGonghuiRoomListVC.m

121 lines
3.5 KiB
Mathematica
Raw Normal View History

2025-08-08 11:05:33 +08:00
//
// SPGonghuiRoomListVC.m
// SweetParty
//
// Created by bj_szd on 2022/6/29.
//
#import "SPGonghuiRoomListVC.h"
#import "SPGonghuiRoomListCell.h"
@interface SPGonghuiRoomListVC ()
@property (nonatomic, strong) UILabel *totalLab;
@end
@implementation SPGonghuiRoomListVC
- (void)viewDidLoad {
[super viewDidLoad];
[self createUI];
[self fetchData];
}
-(void)createUI {
self.view.backgroundColor = [UIColor clearColor];
self.totalLab = [ControlCreator createLabel:self.view rect:CGRectZero text:@"" font:YBBoldFont(15) color:HEXCOLOR(0x333333) backguoundColor:nil align:NSTextAlignmentCenter lines:1];
[self.totalLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(0);
make.left.right.mas_equalTo(0);
make.height.mas_equalTo(40);
}];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.view).offset(40);
make.left.right.bottom.mas_equalTo(0);
}];
[self.tableView registerNib:[UINib nibWithNibName:@"SPGonghuiRoomListCell" bundle:nil] forCellReuseIdentifier:@"SPGonghuiRoomListCell"];
self.tableView.rowHeight = 76;
[self showPullToRefresh];
[self showLoadMoreRefresh];
}
- (void)fetchData {
NSDictionary *params = @{@"guild_id":C_string(self.guild_id), @"type":@(1), @"time":@(self.dateType), @"page":@(self.page), @"page_limit":@"20"};
[AFNetworkRequset.shared postRequestWithParams:params Path:@"api/guild/get_guild_money_log_list" Loading:NO Hud:NO Success:^(id _Nonnull responseDic) {
if (self.page == 1) {
[self.dataArray removeAllObjects];
[self.tableView reloadData];
}
[self endRefresh];
NSArray *arr = [SPGonghuiDetailListModel mj_objectArrayWithKeyValuesArray:responseDic[@"data"][@"list"]];
[self.dataArray addObjectsFromArray:arr];
[self.tableView reloadData];
self.totalLab.text = [NSString stringWithFormat:@"总流水:%@", responseDic[@"data"][@"total_gift_price"]];
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 {
SPGonghuiRoomListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SPGonghuiRoomListCell" forIndexPath:indexPath];
cell.selectionStyle = NO;
SPGonghuiDetailListModel *model = self.dataArray[indexPath.row];
cell.model = model;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
SPGonghuiDetailListModel *model = self.dataArray[indexPath.row];
[UIViewController goMicRoomWithRid:model.rid withPwd:@""];
}
#pragma mark - JXCategoryListContentViewDelegate
- (UIView *)listView {
return self.view;
}
@end