55 lines
2.0 KiB
Objective-C
55 lines
2.0 KiB
Objective-C
//
|
|
// YMHomePresenter.m
|
|
// YUMI
|
|
//
|
|
// Created by YUMI on 2021/11/29.
|
|
//
|
|
|
|
#import "XPHomePresenter.h"
|
|
#import "Api+Home.h"
|
|
#import "AccountInfoStorage.h"
|
|
///Model
|
|
#import "HomeRecommendRoomModel.h"
|
|
///P
|
|
#import "XPHomeProtocol.h"
|
|
#import "HomePlayRoomModel.h"
|
|
@implementation XPHomePresenter
|
|
|
|
|
|
/// 请求首页
|
|
/// @param tabId id
|
|
/// @param page 当前的页数
|
|
/// @param pageSize 一页有多少个
|
|
- (void)getRecommendRoomList:(NSString *)tabId page:(int)page pageSize:(int)pageSize {
|
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
|
NSString * pageStr = [NSString stringWithFormat:@"%d", page];
|
|
NSString * pageSizeStr = [NSString stringWithFormat:@"%d", pageSize];
|
|
[Api getNewRecommendListComplection:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
NSArray * array = [HomePlayRoomModel modelsWithArray:data.data];
|
|
[[self getView] getHomeRecommendRoomListSuccess:array ];
|
|
}fail:^(NSInteger code, NSString * _Nullable msg) {
|
|
[[self getView] getHomeRecommendRoomListFail:msg ];
|
|
}] uid:uid tabId:tabId pageNum:pageStr pageSize:pageSizeStr];
|
|
}
|
|
|
|
/// 获取更多的个播房间
|
|
- (void)getHomeMoreAnchorRoomList {
|
|
[Api homeAnchorMoreRoomList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
NSArray * array = [HomeRecommendRoomModel modelsWithArray:data.data];
|
|
[[self getView] getHomeMoreAnchorRoomListSuccess:array];
|
|
}fail:^(NSInteger code, NSString * _Nullable msg) {
|
|
[[self getView] getHomeMoreAnchorRoomListFail:msg];
|
|
}] singleRoomSortId:@""];
|
|
}
|
|
/// 热门房间(个人房)列表
|
|
- (void)getHomePersonalRoomList{
|
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
|
[Api homePersonalRoomList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
NSArray * array = [HomePlayRoomModel modelsWithArray:data.data];
|
|
[[self getView] getHomePersonalRoomListSuccess:array ];
|
|
}fail:^(NSInteger code, NSString * _Nullable msg) {
|
|
[[self getView]getHomePersonalRoomListFail];
|
|
}errorToast:NO] uid:uid];
|
|
}
|
|
@end
|