大家都在搜接口
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
|
20
xplan-ios/Main/Home/Model/HomeEveryOneSearchModel.h
Normal file
20
xplan-ios/Main/Home/Model/HomeEveryOneSearchModel.h
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// HomeEveryOneSearchModel.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GLEN on 2022/11/29.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
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
|
16
xplan-ios/Main/Home/Model/HomeEveryOneSearchModel.m
Normal file
16
xplan-ios/Main/Home/Model/HomeEveryOneSearchModel.m
Normal file
@@ -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
|
@@ -41,6 +41,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
///是否是推荐房间
|
||||
@property (nonatomic, assign) BOOL isRecommend;
|
||||
|
||||
@property (nonatomic, copy) NSString *erbanNo;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -19,6 +19,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// 获取首页推荐列表
|
||||
- (void)getHomeRecommendRoomList;
|
||||
|
||||
/// 获取大家都在搜的房间列表
|
||||
/// @param sid keyID
|
||||
- (void)getEveryOneSearchRoomList:(NSString *)sid;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -36,4 +36,13 @@
|
||||
}] uid:uid];
|
||||
}
|
||||
|
||||
/// 获取大家都在搜的房间列表
|
||||
/// @param sid keyID
|
||||
- (void)getEveryOneSearchRoomList:(NSString *)sid {
|
||||
[Api requestEveryOneSearchRoomList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
NSArray<HomeRecommendRoomModel *> * array = [HomeRecommendRoomModel modelsWithArray:data.data];
|
||||
[[self getView] everyoneSearchListSuccess:array];
|
||||
}] wordId:sid];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -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];
|
||||
}
|
||||
|
@@ -19,6 +19,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
///搜索页获取推荐房间失败
|
||||
- (void)searchRoomGetRecommendFail;
|
||||
|
||||
/// 大家都在搜房间列表成功
|
||||
- (void)everyoneSearchListSuccess:(NSArray *)list;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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 {
|
||||
|
@@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (void)xPRoomSearchRecordViewControllerSearchWithWord:(NSString *)word;
|
||||
|
||||
///点击了大家都在搜
|
||||
- (void)xPRoomSearchRecordViewControllerEveryoneSearch:(NSString *)word;
|
||||
- (void)xPRoomSearchRecordViewControllerEveryoneSearch:(NSString *)word sid:(NSString *)sid;
|
||||
|
||||
@end
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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];
|
||||
}
|
||||
|
||||
/// 获取好友派对列表
|
||||
|
Reference in New Issue
Block a user