好友派对中接口对接

This commit is contained in:
chenguilong
2022-11-24 19:05:40 +08:00
committed by fengshuo
parent bab2c20aca
commit c40620fc9e
9 changed files with 101 additions and 14 deletions

View File

@@ -173,6 +173,7 @@
9B42869C28C1FD3D009034D2 /* XPOpenRedPacketCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B42869B28C1FD3D009034D2 /* XPOpenRedPacketCell.m */; };
9B46B91728DDA893000E30DB /* XPHomeRedommendCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B46B91628DDA893000E30DB /* XPHomeRedommendCollectionViewCell.m */; };
9B4769AD28DB270F00CCD312 /* XPHomePartyNavView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B4769AC28DB270F00CCD312 /* XPHomePartyNavView.m */; };
9B4C5B86292F81FA00CEA41B /* XPSessionListFansPartyModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B4C5B85292F81FA00CEA41B /* XPSessionListFansPartyModel.m */; };
9B4D148127E485EB000AA0C1 /* XPRoomTrumpetView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B4D148027E485EB000AA0C1 /* XPRoomTrumpetView.m */; };
9B4D449328F15765002572D5 /* XPGiftLuckyGiftBroadcastView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B4D449228F15765002572D5 /* XPGiftLuckyGiftBroadcastView.m */; };
9B4D449628F15EE7002572D5 /* XPGiftWeekStarBroadcastView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B4D449528F15EE7002572D5 /* XPGiftWeekStarBroadcastView.m */; };
@@ -1568,6 +1569,8 @@
9B46B91628DDA893000E30DB /* XPHomeRedommendCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPHomeRedommendCollectionViewCell.m; sourceTree = "<group>"; };
9B4769AB28DB270F00CCD312 /* XPHomePartyNavView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomePartyNavView.h; sourceTree = "<group>"; };
9B4769AC28DB270F00CCD312 /* XPHomePartyNavView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPHomePartyNavView.m; sourceTree = "<group>"; };
9B4C5B84292F81FA00CEA41B /* XPSessionListFansPartyModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPSessionListFansPartyModel.h; sourceTree = "<group>"; };
9B4C5B85292F81FA00CEA41B /* XPSessionListFansPartyModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPSessionListFansPartyModel.m; sourceTree = "<group>"; };
9B4D147F27E485EB000AA0C1 /* XPRoomTrumpetView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomTrumpetView.h; sourceTree = "<group>"; };
9B4D148027E485EB000AA0C1 /* XPRoomTrumpetView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomTrumpetView.m; sourceTree = "<group>"; };
9B4D449128F15765002572D5 /* XPGiftLuckyGiftBroadcastView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPGiftLuckyGiftBroadcastView.h; sourceTree = "<group>"; };
@@ -4457,6 +4460,15 @@
path = Cell;
sourceTree = "<group>";
};
9B4C5B83292F81D000CEA41B /* Model */ = {
isa = PBXGroup;
children = (
9B4C5B84292F81FA00CEA41B /* XPSessionListFansPartyModel.h */,
9B4C5B85292F81FA00CEA41B /* XPSessionListFansPartyModel.m */,
);
path = Model;
sourceTree = "<group>";
};
9B53D57728E2CEE8005187A3 /* Teenager */ = {
isa = PBXGroup;
children = (
@@ -5086,6 +5098,7 @@
9BD798AE29262306003E03E6 /* SessionListHeadView */ = {
isa = PBXGroup;
children = (
9B4C5B83292F81D000CEA41B /* Model */,
9BD798AF29262434003E03E6 /* XPSessionListHeadView.h */,
9BD798B029262434003E03E6 /* XPSessionListHeadView.m */,
9BD798B2292632FE003E03E6 /* XPSessionListHeadItemView.h */,
@@ -9522,6 +9535,7 @@
9B6E8573281AB9B20041A321 /* XPRoomInsideRecommendCell.m in Sources */,
E87A270027588445002DDC7A /* XPHomeListEmptyCollectionViewCell.m in Sources */,
E8A3538528FD67320014A784 /* GiftLuckyBroadcastModel.m in Sources */,
9B4C5B86292F81FA00CEA41B /* XPSessionListFansPartyModel.m in Sources */,
E82325F5274E2E09003A3332 /* XPUserCardPresenter.m in Sources */,
E80EC80B28ACD84000D133C5 /* QInputBarViewConfiguration.m in Sources */,
E880B39E278BD49E00A83B0D /* XPAcrossRoomPKViewController.m in Sources */,

View File

@@ -16,6 +16,7 @@
#import "ClientConfig.h"
///Model
#import "UserInfoModel.h"
#import "XPSessionListFansPartyModel.h"
///View
#import "XPSessionFindNewViewController.h"
#import "TTPopUp.h"
@@ -114,13 +115,24 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
[self getUserInfo];
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
if (self.openType == SessionListOpenTypeDefault) {
[Api requestFansParty:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
NSArray *array = [XPSessionListFansPartyModel modelsWithArray:data.data];
self.headView.friendsArray = array;
}
}];
}
}
- (void)getUserInfo {
NSString * uid = [AccountInfoStorage instance].getUid;
[Api getUserInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
UserInfoModel * userInfo = [UserInfoModel modelWithDictionary:data.data];
self.userInfo = userInfo;
// [self.sessionListView reloadData];
[self.sessionListView reloadData];
[self.headView updateToolViewWithUserLevel:self.userInfo.userLevelVo.charmLevelSeq];
}
} uid:uid];

View File

@@ -0,0 +1,23 @@
//
// XPSessionListFansPartyModel.h
// xplan-ios
//
// Created by GreenLand on 2022/11/24.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPSessionListFansPartyModel : NSObject
@property (nonatomic, copy) NSString *avatar;
@property (nonatomic, copy) NSString *uid;
@property (nonatomic, copy) NSString *erbanNo;
@property (nonatomic, copy) NSString *nick;
@property (nonatomic, copy) NSString *roomUid;
@property (nonatomic, assign) NSInteger gender;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,12 @@
//
// XPSessionListFansPartyModel.m
// xplan-ios
//
// Created by GreenLand on 2022/11/24.
//
#import "XPSessionListFansPartyModel.h"
@implementation XPSessionListFansPartyModel
@end

View File

@@ -9,8 +9,11 @@
NS_ASSUME_NONNULL_BEGIN
@class XPSessionListFansPartyModel;
@interface XPSessionListHeadFriendCell : UICollectionViewCell
- (void)configData:(XPSessionListFansPartyModel *)data;
@end
NS_ASSUME_NONNULL_END

View File

@@ -10,6 +10,7 @@
#import "ThemeColor.h"
#import "NetImageView.h"
#import "UIImage+Utils.h"
#import "XPSessionListFansPartyModel.h"
@interface XPSessionListHeadFriendCell()
@@ -51,6 +52,7 @@
make.centerX.mas_equalTo(self);
make.top.mas_equalTo(self.dotView.mas_bottom).mas_offset(2);
make.height.mas_equalTo(17);
make.left.mas_equalTo(0);
}];
[self.genderImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.bottom.mas_equalTo(self.dotView);
@@ -58,20 +60,20 @@
}];
}
- (void)setTitle:(NSString *)title {
self.nameLabel.text = title;
}
- (void)setImageName:(NSString *)imageName {
self.imageView.image = [UIImage imageNamed:imageName];
- (void)configData:(XPSessionListFansPartyModel *)data {
self.imageView.imageUrl = data.avatar;
NSString *name = data.nick.length > 4 ? [data.nick substringToIndex:4] : data.nick;
self.nameLabel.text = name;
self.genderImageView.image = data.gender == 1 ? [UIImage imageNamed:@"common_male"] : [UIImage imageNamed:@"common_female"];
}
- (UILabel *)nameLabel {
if (!_nameLabel) {
_nameLabel = [[UILabel alloc] initWithFrame:CGRectZero];
_nameLabel.backgroundColor = [UIColor clearColor];
_nameLabel.font = [UIFont systemFontOfSize:14];
_nameLabel.textColor = ThemeColor.mainTextColor;
_nameLabel.font = [UIFont systemFontOfSize:12];
_nameLabel.textColor = ThemeColor.secondTextColor;
_nameLabel.textAlignment = NSTextAlignmentCenter;
}
return _nameLabel;
}

View File

@@ -15,6 +15,9 @@
#import "XPSessionListHeadItemView.h"
#import "XPSessionListHeadFriendCell.h"
#import "NSArray+Safe.h"
#import "XPSessionListFansPartyModel.h"
#import "XCCurrentVCStackManager.h"
#import "XPRoomViewController.h"
NSString * const kMengXinShowReadDotKey = @"kMengXinShowReadDotKey";
@@ -106,18 +109,19 @@ NSString * const kMengXinShowReadDotKey = @"kMengXinShowReadDotKey";
#pragma mark - UICollectionViewDelegate
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
// return self.friendsArray.count;
return 6;
return self.friendsArray.count;
}
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
XPSessionListHeadFriendCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPSessionListHeadFriendCell class]) forIndexPath:indexPath];
XPSessionListFansPartyModel *model = [self.friendsArray safeObjectAtIndex1:indexPath.row];
[cell configData:model];
return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
XPSessionListFansPartyModel *model = [self.friendsArray safeObjectAtIndex1:indexPath.row];
[XPRoomViewController openRoom:model.uid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
}
- (void)updateToolViewWithUserLevel:(NSInteger)level {
@@ -194,6 +198,13 @@ NSString * const kMengXinShowReadDotKey = @"kMengXinShowReadDotKey";
}
}
- (void)setFriendsArray:(NSArray *)friendsArray {
_friendsArray = friendsArray;
if (friendsArray.count) {
self.friendContentView.hidden = NO;
[self.collectionView reloadData];
}
}
- (UIStackView *)mainStackView {
if (!_mainStackView) {
_mainStackView = [[UIStackView alloc] init];
@@ -223,7 +234,7 @@ NSString * const kMengXinShowReadDotKey = @"kMengXinShowReadDotKey";
- (UIView *)friendContentView {
if (!_friendContentView) {
_friendContentView = [[UIView alloc] init];
// _friendContentView.hidden = YES;
_friendContentView.hidden = YES;
}
return _friendContentView;
}

View File

@@ -276,6 +276,10 @@ NS_ASSUME_NONNULL_BEGIN
/// @param uid uid
+ (void)requestEveryoneSearch:(HttpRequestHelperCompletion)completion uid:(NSString *)uid;
/// 获取好友派对列表
/// @param completion 完成
+ (void)requestFansParty:(HttpRequestHelperCompletion)completion;
@end
NS_ASSUME_NONNULL_END

View File

@@ -310,4 +310,10 @@
[self makeRequest:@"" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, uid, nil];
}
///
/// @param completion
+ (void)requestFansParty:(HttpRequestHelperCompletion)completion {
[self makeRequest:@"fans/fansPartList" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, nil];
}
@end