diff --git a/xplan-ios.xcodeproj/project.pbxproj b/xplan-ios.xcodeproj/project.pbxproj index f16d9202..9158f310 100644 --- a/xplan-ios.xcodeproj/project.pbxproj +++ b/xplan-ios.xcodeproj/project.pbxproj @@ -1232,6 +1232,7 @@ E8F9168727EC927C00F10D8F /* XPHomeLittleGamePesenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E8F9168627EC927C00F10D8F /* XPHomeLittleGamePesenter.m */; }; E8F9168B27EC940E00F10D8F /* XPHomeLittleGameTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E8F9168A27EC940E00F10D8F /* XPHomeLittleGameTableViewCell.m */; }; E8F9168E27ECA69500F10D8F /* HomeLittleGameRoomModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8F9168D27ECA69500F10D8F /* HomeLittleGameRoomModel.m */; }; + F183EF412935E1C000E2465F /* HomeEveryOneSearchModel.m in Sources */ = {isa = PBXBuildFile; fileRef = F183EF402935E1C000E2465F /* HomeEveryOneSearchModel.m */; }; F1D8556F2931FC86008C418F /* XPRoomYearActivityView.m in Sources */ = {isa = PBXBuildFile; fileRef = F1D8556E2931FC86008C418F /* XPRoomYearActivityView.m */; }; /* End PBXBuildFile section */ @@ -3547,6 +3548,8 @@ E8F9168A27EC940E00F10D8F /* XPHomeLittleGameTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPHomeLittleGameTableViewCell.m; sourceTree = ""; }; E8F9168C27ECA69500F10D8F /* HomeLittleGameRoomModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HomeLittleGameRoomModel.h; sourceTree = ""; }; E8F9168D27ECA69500F10D8F /* HomeLittleGameRoomModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HomeLittleGameRoomModel.m; sourceTree = ""; }; + F183EF3F2935E1C000E2465F /* HomeEveryOneSearchModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HomeEveryOneSearchModel.h; sourceTree = ""; }; + F183EF402935E1C000E2465F /* HomeEveryOneSearchModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HomeEveryOneSearchModel.m; sourceTree = ""; }; F1D8556D2931FC86008C418F /* XPRoomYearActivityView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomYearActivityView.h; sourceTree = ""; }; F1D8556E2931FC86008C418F /* XPRoomYearActivityView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomYearActivityView.m; sourceTree = ""; }; /* End PBXFileReference section */ @@ -8251,6 +8254,8 @@ 9B3353C128816E6F00AC2F24 /* HomeLiveTagModel.m */, 9B39C8842885408C00564D17 /* HomeLiveLookRecordModel.h */, 9B39C8852885408C00564D17 /* HomeLiveLookRecordModel.m */, + F183EF3F2935E1C000E2465F /* HomeEveryOneSearchModel.h */, + F183EF402935E1C000E2465F /* HomeEveryOneSearchModel.m */, ); path = Model; sourceTree = ""; @@ -9485,6 +9490,7 @@ E81C1B1F27705F7A0020D1E4 /* XPArrangeMicViewController.m in Sources */, E8B825C726EA0D9A009E8E9F /* LoginVerifCodeProtocol.h in Sources */, E8A1F7A8290690E00099C952 /* XPNobleRankUpdateView.m in Sources */, + F183EF412935E1C000E2465F /* HomeEveryOneSearchModel.m in Sources */, 9BAC92F528E6E63000147DD8 /* XPRoomInsideOperationCell.m in Sources */, 9BE570BC28F65B7200D491A5 /* XPMineCollectRoomCell.m in Sources */, E86A16C22856D635004228B8 /* XPSessionFindNewGreetTableViewCell.m in Sources */, diff --git a/xplan-ios/Main/Home/Api/Api+Home.h b/xplan-ios/Main/Home/Api/Api+Home.h index 5978666e..ceda7ff4 100644 --- a/xplan-ios/Main/Home/Api/Api+Home.h +++ b/xplan-ios/Main/Home/Api/Api+Home.h @@ -45,6 +45,11 @@ NS_ASSUME_NONNULL_BEGIN page:(NSString *)page pageSize:(NSString *)pageSize; +/// 大家都在搜的房间列表 +/// @param completion 完成 +/// @param sid sid ++ (void)requestEveryOneSearchRoomList:(HttpRequestHelperCompletion)completion wordId:(NSString *)sid; + /// 首页推荐的轮播图 /// @param completion 完成 /// @param uid 用户的uid diff --git a/xplan-ios/Main/Home/Api/Api+Home.m b/xplan-ios/Main/Home/Api/Api+Home.m index 8a7bc877..eaa9e06a 100644 --- a/xplan-ios/Main/Home/Api/Api+Home.m +++ b/xplan-ios/Main/Home/Api/Api+Home.m @@ -44,6 +44,13 @@ [self makeRequest:@"search/room" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, key, type, page, pageSize, nil]; } +/// 大家都在搜的房间列表 +/// @param completion 完成 +/// @param sid sid ++ (void)requestEveryOneSearchRoomList:(HttpRequestHelperCompletion)completion wordId:(NSString *)sid { + [self makeRequest:@"every/one/search/getRoomList" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, sid, nil]; +} + /// 首页推荐的轮播图 /// @param completion 完成 /// @param uid 用户的uid diff --git a/xplan-ios/Main/Home/Model/HomeEveryOneSearchModel.h b/xplan-ios/Main/Home/Model/HomeEveryOneSearchModel.h new file mode 100644 index 00000000..27b6d999 --- /dev/null +++ b/xplan-ios/Main/Home/Model/HomeEveryOneSearchModel.h @@ -0,0 +1,20 @@ +// +// HomeEveryOneSearchModel.h +// xplan-ios +// +// Created by GLEN on 2022/11/29. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface HomeEveryOneSearchModel : NSObject + +@property (nonatomic, copy) NSString *sid; +@property (nonatomic, copy) NSString *relationRoomUid; +@property (nonatomic, copy) NSString *word; + +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Home/Model/HomeEveryOneSearchModel.m b/xplan-ios/Main/Home/Model/HomeEveryOneSearchModel.m new file mode 100644 index 00000000..c18b98d6 --- /dev/null +++ b/xplan-ios/Main/Home/Model/HomeEveryOneSearchModel.m @@ -0,0 +1,16 @@ +// +// HomeEveryOneSearchModel.m +// xplan-ios +// +// Created by GLEN on 2022/11/29. +// + +#import "HomeEveryOneSearchModel.h" + +@implementation HomeEveryOneSearchModel + ++ (NSDictionary *)replacedKeyFromPropertyName { + return @{@"sid":@"id"}; +} + +@end diff --git a/xplan-ios/Main/Home/Model/HomeRecommendRoomModel.h b/xplan-ios/Main/Home/Model/HomeRecommendRoomModel.h index 0877b0e3..941c7f1a 100644 --- a/xplan-ios/Main/Home/Model/HomeRecommendRoomModel.h +++ b/xplan-ios/Main/Home/Model/HomeRecommendRoomModel.h @@ -41,6 +41,8 @@ NS_ASSUME_NONNULL_BEGIN ///是否是推荐房间 @property (nonatomic, assign) BOOL isRecommend; +@property (nonatomic, copy) NSString *erbanNo; + @end NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Home/Presenter/XPHomeSearchPresenter.h b/xplan-ios/Main/Home/Presenter/XPHomeSearchPresenter.h index 12b4d96a..ff58a0c2 100644 --- a/xplan-ios/Main/Home/Presenter/XPHomeSearchPresenter.h +++ b/xplan-ios/Main/Home/Presenter/XPHomeSearchPresenter.h @@ -19,6 +19,10 @@ NS_ASSUME_NONNULL_BEGIN /// 获取首页推荐列表 - (void)getHomeRecommendRoomList; +/// 获取大家都在搜的房间列表 +/// @param sid keyID +- (void)getEveryOneSearchRoomList:(NSString *)sid; + @end NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Home/Presenter/XPHomeSearchPresenter.m b/xplan-ios/Main/Home/Presenter/XPHomeSearchPresenter.m index 581a2005..d3b9f779 100644 --- a/xplan-ios/Main/Home/Presenter/XPHomeSearchPresenter.m +++ b/xplan-ios/Main/Home/Presenter/XPHomeSearchPresenter.m @@ -36,4 +36,13 @@ }] uid:uid]; } +/// 获取大家都在搜的房间列表 +/// @param sid keyID +- (void)getEveryOneSearchRoomList:(NSString *)sid { + [Api requestEveryOneSearchRoomList:[self createHttpCompletion:^(BaseModel * _Nonnull data) { + NSArray * array = [HomeRecommendRoomModel modelsWithArray:data.data]; + [[self getView] everyoneSearchListSuccess:array]; + }] wordId:sid]; +} + @end diff --git a/xplan-ios/Main/Home/Presenter/XPInRoomRecordPresenter.m b/xplan-ios/Main/Home/Presenter/XPInRoomRecordPresenter.m index 834decce..ce39e5ec 100644 --- a/xplan-ios/Main/Home/Presenter/XPInRoomRecordPresenter.m +++ b/xplan-ios/Main/Home/Presenter/XPInRoomRecordPresenter.m @@ -9,6 +9,7 @@ #import "Api+Mine.h" #import "AccountInfoStorage.h" #import "XPMineFootPrintModel.h" +#import "HomeEveryOneSearchModel.h" #import "XPInRoomRecordProtocol.h" @implementation XPInRoomRecordPresenter @@ -35,7 +36,7 @@ - (void)getEveryoneSearchList { NSString *uid = [AccountInfoStorage instance].getUid; [Api requestEveryoneSearch:[self createHttpCompletion:^(BaseModel * _Nonnull data) { - NSArray *array = [XPMineFootPrintModel modelsWithArray:data.data]; + NSArray *array = [HomeEveryOneSearchModel modelsWithArray:data.data]; [[self getView] getEveryoneSearchListSuccess:array]; }] uid:uid]; } diff --git a/xplan-ios/Main/Home/Protocol/XPHomeSearchProtocol.h b/xplan-ios/Main/Home/Protocol/XPHomeSearchProtocol.h index 86ea87b6..30f2d3f0 100644 --- a/xplan-ios/Main/Home/Protocol/XPHomeSearchProtocol.h +++ b/xplan-ios/Main/Home/Protocol/XPHomeSearchProtocol.h @@ -19,6 +19,9 @@ NS_ASSUME_NONNULL_BEGIN ///搜索页获取推荐房间失败 - (void)searchRoomGetRecommendFail; +/// 大家都在搜房间列表成功 +- (void)everyoneSearchListSuccess:(NSArray *)list; + @end NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Home/View/Cell/XPSearchListTableViewCell.h b/xplan-ios/Main/Home/View/Cell/XPSearchListTableViewCell.h index e88d18df..78977b51 100644 --- a/xplan-ios/Main/Home/View/Cell/XPSearchListTableViewCell.h +++ b/xplan-ios/Main/Home/View/Cell/XPSearchListTableViewCell.h @@ -14,11 +14,15 @@ typedef NS_ENUM(NSInteger, SearchType){ SearchType_Users = 2, }; -@class HomeSearchResultModel; +@class HomeSearchResultModel, HomeRecommendRoomModel; @interface XPSearchListTableViewCell : UITableViewCell ///配置数据 - (void)configData:(HomeSearchResultModel *)resultModel type:(SearchType)type; + +///配置大家都在搜房间列表 +- (void)configEveryoneData:(HomeRecommendRoomModel *)resultModel; + @end NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Home/View/Cell/XPSearchListTableViewCell.m b/xplan-ios/Main/Home/View/Cell/XPSearchListTableViewCell.m index 5c8e68d3..ab3bb5da 100644 --- a/xplan-ios/Main/Home/View/Cell/XPSearchListTableViewCell.m +++ b/xplan-ios/Main/Home/View/Cell/XPSearchListTableViewCell.m @@ -12,6 +12,7 @@ #import "ThemeColor.h" ///Model #import "HomeSearchResultModel.h" +#import "HomeRecommendRoomModel.h" ///View #import "NetImageView.h" @@ -66,6 +67,22 @@ } } } + +- (void)configEveryoneData:(HomeRecommendRoomModel *)resultModel { + if (resultModel) { + self.avatarImageView.imageUrl = resultModel.avatar; + self.nickLabel.text = resultModel.title ; + self.idLabel.text = [NSString stringWithFormat:@"%@号:%@",AppName, resultModel.erbanNo]; + self.sexImageView.image = resultModel.gender == GenderType_Female ? [UIImage imageNamed:@"common_female"] : [UIImage imageNamed:@"common_male"]; + if (resultModel.onlineNum > 100) { + self.numberLabel.text = [NSString stringWithFormat:@"%ld", resultModel.onlineNum]; + } else { + self.numberLabel.text = [NSString stringWithFormat:@" %ld ", resultModel.onlineNum]; + } + self.numberView.hidden = YES; + } +} + #pragma mark - Private Method - (void)initSubViews { self.selectionStyle = UITableViewCellSelectionStyleNone; diff --git a/xplan-ios/Main/Home/View/SubViews/HomeSearchRelateView/XPHomeSearchRelateView.m b/xplan-ios/Main/Home/View/SubViews/HomeSearchRelateView/XPHomeSearchRelateView.m index 2fdca0f8..3d94bdec 100644 --- a/xplan-ios/Main/Home/View/SubViews/HomeSearchRelateView/XPHomeSearchRelateView.m +++ b/xplan-ios/Main/Home/View/SubViews/HomeSearchRelateView/XPHomeSearchRelateView.m @@ -69,18 +69,22 @@ if (cell == nil) { cell = [[XPSearchListTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPSearchListTableViewCell class])]; } - HomeSearchResultModel * resultModel = [self.relateArray safeObjectAtIndex1:indexPath.row]; - [cell configData:resultModel type:1]; + HomeRecommendRoomModel * resultModel = [self.relateArray safeObjectAtIndex1:indexPath.row]; + [cell configEveryoneData:resultModel]; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - HomeSearchResultModel * resultModel = [self.relateArray safeObjectAtIndex1:indexPath.row]; + HomeRecommendRoomModel * resultModel = [self.relateArray safeObjectAtIndex1:indexPath.row]; if (self.delegate && [self.delegate respondsToSelector:@selector(xPHomeSearchRelateViewEnterRoom:)]) { [self.delegate xPHomeSearchRelateViewEnterRoom:resultModel.uid]; } } +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + return 74; +} + #pragma mark - collectionViewDelegate - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { return self.recommendArray.count; @@ -132,7 +136,7 @@ if (!_relateTitle) { UILabel *label = [[UILabel alloc] init]; label.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium]; -// label.textColor = [ThemeColor mainTextColor]; + label.textColor = [ThemeColor mainTextColor]; label.text = @"相关房间"; _relateTitle = label; } diff --git a/xplan-ios/Main/Home/View/XPRoomSearchContainerViewController.m b/xplan-ios/Main/Home/View/XPRoomSearchContainerViewController.m index f76d7a4a..aaea5b45 100644 --- a/xplan-ios/Main/Home/View/XPRoomSearchContainerViewController.m +++ b/xplan-ios/Main/Home/View/XPRoomSearchContainerViewController.m @@ -169,26 +169,24 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey; } ///大家都在搜 -- (void)xPRoomSearchRecordViewControllerEveryoneSearch:(NSString *)word { +- (void)xPRoomSearchRecordViewControllerEveryoneSearch:(NSString *)word sid:(nonnull NSString *)sid { self.searchView.searchTextField.text = word; [self.recordVc storeSearchRecord:word]; - [self.presenter searchRoomList:word type:@"3"]; + [self.presenter getEveryOneSearchRoomList:sid]; } #pragma mark - XPHomeSearchProtocol -- (void)searchRoomSuccess:(NSArray *)data type:(nonnull NSString *)type { - if (type.integerValue == 3) { - if (data.count) {//有值,显示列表 +- (void)everyoneSearchListSuccess:(NSArray *)list { + if (list.count) {//有值,显示列表 [self.view addSubview:self.relateView]; [self.relateView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.bottom.mas_equalTo(0); make.top.mas_equalTo(self.searchView.mas_bottom); }]; - self.relateView.relateArray = data; + self.relateView.relateArray = list; } else {//无数据,显示推荐房间 [self.presenter getHomeRecommendRoomList]; } - } } - (void)searchRoomGetRecommendSuccess:(NSArray *)data { diff --git a/xplan-ios/Main/Home/View/XPRoomSearchRecordViewController.h b/xplan-ios/Main/Home/View/XPRoomSearchRecordViewController.h index f054cf99..8ad8283a 100644 --- a/xplan-ios/Main/Home/View/XPRoomSearchRecordViewController.h +++ b/xplan-ios/Main/Home/View/XPRoomSearchRecordViewController.h @@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)xPRoomSearchRecordViewControllerSearchWithWord:(NSString *)word; ///点击了大家都在搜 -- (void)xPRoomSearchRecordViewControllerEveryoneSearch:(NSString *)word; +- (void)xPRoomSearchRecordViewControllerEveryoneSearch:(NSString *)word sid:(NSString *)sid; @end diff --git a/xplan-ios/Main/Home/View/XPRoomSearchRecordViewController.m b/xplan-ios/Main/Home/View/XPRoomSearchRecordViewController.m index ab2867da..76ea4538 100644 --- a/xplan-ios/Main/Home/View/XPRoomSearchRecordViewController.m +++ b/xplan-ios/Main/Home/View/XPRoomSearchRecordViewController.m @@ -23,6 +23,7 @@ #import "XPInRoomRecordProtocol.h" ///Model #import "XPMineFootPrintModel.h" +#import "HomeEveryOneSearchModel.h" NSString * const XPConstSearchRecordStoreKey = @"XPConstSearchRecordStoreKey"; @@ -188,7 +189,8 @@ NSString * const XPConstSearchRecordStoreKey = @"XPConstSearchRecordStoreKey"; return cell; } else if (collectionView == self.everyOneCollectionView) { XPHomeSearchRecordCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPHomeSearchRecordCell class]) forIndexPath:indexPath]; - cell.recordString = [self.everyoneSearchList safeObjectAtIndex1:indexPath.row]; + HomeEveryOneSearchModel *model = [self.everyoneSearchList safeObjectAtIndex1:indexPath.row]; + cell.recordString = model.word; return cell; } else { XPHomeAttentionCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPHomeAttentionCollectionViewCell class]) forIndexPath:indexPath]; @@ -204,9 +206,9 @@ NSString * const XPConstSearchRecordStoreKey = @"XPConstSearchRecordStoreKey"; [self.delegate xPRoomSearchRecordViewControllerSearchWithWord:str]; } } else if (collectionView == self.everyOneCollectionView) { - NSString *str = self.searchList[indexPath.row]; - if (self.delegate && [self.delegate respondsToSelector:@selector(xPRoomSearchRecordViewControllerEveryoneSearch:)]) { - [self.delegate xPRoomSearchRecordViewControllerEveryoneSearch:str]; + HomeEveryOneSearchModel *model = [self.everyoneSearchList safeObjectAtIndex1:indexPath.row]; + if (self.delegate && [self.delegate respondsToSelector:@selector(xPRoomSearchRecordViewControllerEveryoneSearch: sid:)]) { + [self.delegate xPRoomSearchRecordViewControllerEveryoneSearch:model.word sid:model.sid]; } } else { XPMineFootPrintModel *resultModel = self.inRoomList[indexPath.row]; @@ -227,8 +229,8 @@ NSString * const XPConstSearchRecordStoreKey = @"XPConstSearchRecordStoreKey"; CGFloat width = [str boundingRectWithSize:CGSizeMake(200, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:12]} context:nil].size.width; return CGSizeMake(width + 26, 26); } else if(collectionView == self.everyOneCollectionView){ - NSString *str = [self.everyoneSearchList safeObjectAtIndex1:indexPath.row]; - CGFloat width = [str boundingRectWithSize:CGSizeMake(200, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:12]} context:nil].size.width; + HomeEveryOneSearchModel *model = [self.everyoneSearchList safeObjectAtIndex1:indexPath.row]; + CGFloat width = [model.word boundingRectWithSize:CGSizeMake(200, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:12]} context:nil].size.width; return CGSizeMake(width + 26, 26); } else { return CGSizeMake(56, 75); diff --git a/xplan-ios/Main/Mine/Api/Api+Mine.m b/xplan-ios/Main/Mine/Api/Api+Mine.m index b51d0366..dc115d09 100644 --- a/xplan-ios/Main/Mine/Api/Api+Mine.m +++ b/xplan-ios/Main/Mine/Api/Api+Mine.m @@ -306,8 +306,7 @@ /// @param completion 完成 /// @param uid uid + (void)requestEveryoneSearch:(HttpRequestHelperCompletion)completion uid:(NSString *)uid { - #warning todo - [self makeRequest:@"" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, uid, nil]; + [self makeRequest:@"every/one/search/getList" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, uid, nil]; } /// 获取好友派对列表