78 lines
2.7 KiB
Objective-C
78 lines
2.7 KiB
Objective-C
//
|
|
// XPHomeContainerPresenter.m
|
|
// YuMi
|
|
//
|
|
// Created by YuMi on 2021/12/2.
|
|
//
|
|
|
|
#import "XPHomeContainerPresenter.h"
|
|
#import "Api+Home.h"
|
|
#import "AccountInfoStorage.h"
|
|
#import "HomeTagModel.h"
|
|
#import "XPHomeContainerProtocol.h"
|
|
#import "AccountInfoStorage.h"
|
|
#import "HomeBannerInfoModel.h"
|
|
#import "PIHomeItemModel.h"
|
|
#import "PIHomeCategoryTitleModel.h"
|
|
@implementation XPHomeContainerPresenter
|
|
///得到首页轮播图
|
|
- (void)getHomeTopBannerList{
|
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
|
[Api homeBannerList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
NSArray * array = [HomeBannerInfoModel modelsWithArray:data.data];
|
|
[[self getView]getHomeTopBannerListSuccess:array];
|
|
}fail:^(NSInteger code, NSString * _Nullable msg) {
|
|
|
|
} errorToast:NO] uid:uid type:@"1"];
|
|
}
|
|
|
|
/// 获取所有的房间的tag
|
|
- (void)getHomeTagList {
|
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
|
[Api homeTagComplection:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
NSArray * array = [PIHomeCategoryTitleModel modelsWithArray:data.data];
|
|
for (PIHomeCategoryTitleModel *model in array) {
|
|
model.checkedWidth = [UILabel getWidthWithText:model.name height:kGetScaleWidth(44) font:kFontSemibold(16)];
|
|
model.noCheckedWidth = [UILabel getWidthWithText:model.name height:kGetScaleWidth(44) font:kFontRegular(14)];
|
|
}
|
|
[[self getView] getHomeTagListSuccess:array];
|
|
|
|
}] uid:uid];
|
|
}
|
|
///首页改版资源位
|
|
-(void)getCurrentResourceList{
|
|
[Api requestCurrentResourceListComplection:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
NSArray *list = [PIHomeItemModel modelsWithArray:data.data];
|
|
[[self getView]getCurrentResourceListSuccess:list];
|
|
}]];
|
|
}
|
|
/// 一键匹配
|
|
- (void)homeChatPick {
|
|
[Api homeChatPick:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
if (data.data) {
|
|
NSString *uid = [NSString stringWithFormat:@"%@",data.data];
|
|
[[self getView] homeChatPickSuccess:uid];
|
|
}else{
|
|
[[self getView] homeChatPickFail:data.message];
|
|
}
|
|
}fail:^(NSInteger code, NSString * _Nullable msg) {
|
|
[[self getView] homeChatPickFail:msg];
|
|
} showLoading:YES errorToast:YES]];
|
|
}
|
|
///ip检测
|
|
-(void)checkIpRegionAction{
|
|
[Api checkIpRegionComplection:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
|
if(code == 200){
|
|
if(data.data != nil){
|
|
NSInteger time = [data.data integerValue]/1000;
|
|
[[self getView]checkIpRegionSuccess:time];
|
|
}
|
|
return;
|
|
}
|
|
if(code == 401){
|
|
[[self getView]checkIpRegionFailWithMsg:msg];
|
|
}
|
|
}];
|
|
}
|
|
@end
|