Files
peko-ios/YuMi/Modules/YMNewHome/Presenter/XPHomeContainerPresenter.m

79 lines
2.7 KiB
Mathematica
Raw Normal View History

2023-07-14 18:50:55 +08:00
//
// 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"
2023-09-01 18:58:41 +08:00
#import "HomeBannerInfoModel.h"
2023-09-05 11:45:21 +08:00
#import "PIHomeItemModel.h"
2023-07-14 18:50:55 +08:00
@implementation XPHomeContainerPresenter
2023-09-01 18:58:41 +08:00
///
- (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"];
}
2023-11-20 19:29:01 +08:00
2023-07-14 18:50:55 +08:00
/// tag
- (void)getHomeTagList {
NSString * uid = [[AccountInfoStorage instance] getUid];
NSArray<HomeTagModel *> *list = [[AccountInfoStorage instance]getCurrentTagList];
if(list.count > 0){
[[self getView] getHomeTagListSuccess:list];
}
[Api homeTagComplection:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
NSArray * array = [HomeTagModel modelsWithArray:data.data];
[[AccountInfoStorage instance]saveTagList:array];
if(list.count == 0 || list.count != array.count){
[[self getView] getHomeTagListSuccess:array];
}
}] uid:uid];
}
2023-09-05 11:45:21 +08:00
///
-(void)getCurrentResourceList{
[Api requestCurrentResourceListComplection:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
NSArray *list = [PIHomeItemModel modelsWithArray:data.data];
[[self getView]getCurrentResourceListSuccess:list];
}]];
}
2023-09-05 15:37:02 +08:00
///
- (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]];
}
2023-11-23 10:56:01 +08:00
///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];
}
}];
}
2023-07-14 18:50:55 +08:00
@end