159 lines
4.7 KiB
Objective-C
Executable File
159 lines
4.7 KiB
Objective-C
Executable File
//
|
|
// SPGonghuiUserListVC.m
|
|
// SweetParty
|
|
//
|
|
// Created by bj_szd on 2022/6/29.
|
|
//
|
|
|
|
#import "SPGonghuiUserListVC.h"
|
|
#import "SPGonghuiUserListCell.h"
|
|
|
|
@interface SPGonghuiUserListVC ()
|
|
|
|
@property (nonatomic, assign) NSInteger is_deacon;
|
|
|
|
@property (nonatomic, strong) UILabel *totalLab;
|
|
|
|
@end
|
|
|
|
@implementation SPGonghuiUserListVC
|
|
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
|
|
[self createUI];
|
|
|
|
[self fetchData];
|
|
|
|
[self onJudgeHuizhang];
|
|
}
|
|
|
|
-(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:@"SPGonghuiUserListCell" bundle:nil] forCellReuseIdentifier:@"SPGonghuiUserListCell"];
|
|
self.tableView.rowHeight = 76;
|
|
|
|
[self showPullToRefresh];
|
|
[self showLoadMoreRefresh];
|
|
}
|
|
|
|
- (void)fetchData {
|
|
NSDictionary *params = @{@"guild_id":C_string(self.guild_id), @"type":@(2), @"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];
|
|
}
|
|
|
|
- (void)onJudgeHuizhang {
|
|
NSDictionary *params = @{@"guild_id":C_string(self.guild_id)};
|
|
[AFNetworkRequset.shared postRequestWithParams:params Path:@"api/guild/user_is_deacon" Loading:NO Hud:NO Success:^(id _Nonnull responseDic) {
|
|
NSInteger is_deacon = [responseDic[@"data"] safeIntForKey:@"is_deacon"];
|
|
self.is_deacon = is_deacon;
|
|
[self.tableView reloadData];
|
|
} Failure:^(id _Nonnull errorData) {
|
|
|
|
}];
|
|
}
|
|
|
|
#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 {
|
|
SPGonghuiUserListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SPGonghuiUserListCell" forIndexPath:indexPath];
|
|
cell.selectionStyle = NO;
|
|
SPGonghuiDetailListModel *model = self.dataArray[indexPath.row];
|
|
cell.model = model;
|
|
|
|
if (0 == indexPath.row) {
|
|
cell.huizhangBtn.hidden = NO;
|
|
cell.yichuBtn.hidden = YES;
|
|
}else {
|
|
cell.huizhangBtn.hidden = YES;
|
|
cell.yichuBtn.hidden = self.is_deacon != 1;
|
|
}
|
|
|
|
WEAK_SELF
|
|
cell.onYichuBlock = ^{
|
|
[weakSelf onYichuUserWith:model];
|
|
};
|
|
|
|
return cell;
|
|
}
|
|
|
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
SPGonghuiDetailListModel *model = self.dataArray[indexPath.row];
|
|
[UIViewController goUserMainpageWith:model.uid withRid:@""];
|
|
}
|
|
|
|
- (void)onYichuUserWith:(SPGonghuiDetailListModel *)model {
|
|
NSDictionary *params = @{@"user_id":C_string(model.uid), @"guild_id":C_string(self.guild_id)};
|
|
[AFNetworkRequset.shared postRequestWithParams:params Path:@"api/guild/kick_out_guild" Loading:YES Hud:YES Success:^(id _Nonnull responseDic) {
|
|
[self.dataArray removeObject:model];
|
|
[self.tableView reloadData];
|
|
} Failure:^(id _Nonnull errorData) {
|
|
|
|
}];
|
|
}
|
|
|
|
#pragma mark - JXCategoryListContentViewDelegate
|
|
|
|
- (UIView *)listView {
|
|
return self.view;
|
|
}
|
|
|
|
@end
|