2023-07-14 18:50:55 +08:00
|
|
|
//
|
|
|
|
// YMMinePresent.m
|
|
|
|
// YUMI
|
|
|
|
//
|
|
|
|
// Created by YUMI on 2021/9/16.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "XPMinePresent.h"
|
|
|
|
///Tool
|
|
|
|
#import "AccountInfoStorage.h"
|
|
|
|
#import "StatisticsServiceHelper.h"
|
|
|
|
///Api
|
|
|
|
#import "Api+Mine.h"
|
|
|
|
#import "Api+Guild.h"
|
|
|
|
#import "Api+Home.h"
|
2023-09-01 14:29:14 +08:00
|
|
|
#import "Api+LittleGame.h"
|
2023-07-14 18:50:55 +08:00
|
|
|
///Model
|
|
|
|
#import "XPMineItemModel.h"
|
|
|
|
#import "UserInfoModel.h"
|
|
|
|
#import "ClanDetailInfoModel.h"
|
|
|
|
#import "XPMineFuntionItemModel.h"
|
|
|
|
#import "HomeBannerInfoModel.h"
|
|
|
|
#import "WalletInfoModel.h"
|
|
|
|
#import "ClanDetailInfoModel.h"
|
2023-09-01 14:29:14 +08:00
|
|
|
#import "LittleGameInfoModel.h"
|
|
|
|
#import "HomeLittleGameRoomModel.h"
|
2023-07-14 18:50:55 +08:00
|
|
|
///Protocol
|
|
|
|
#import "XPMineProtocol.h"
|
|
|
|
#import "Api+NobleCenter.h"
|
|
|
|
#import "NobleCenterModel.h"
|
|
|
|
@implementation XPMinePresent
|
|
|
|
|
|
|
|
/// 获取用户信息
|
|
|
|
- (void)getUserInfo {
|
|
|
|
NSString * uid = [[AccountInfoStorage instance] getUid];
|
|
|
|
if (!uid.length) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
[Api getUserInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
|
|
UserInfoModel * infoModel = [UserInfoModel modelWithDictionary:data.data];
|
|
|
|
[[self getView] onGetUserInfoSuccess:infoModel];
|
|
|
|
}errorToast:NO] uid:uid];
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 获取钱包信息
|
2023-11-02 11:14:35 +08:00
|
|
|
- (void)getUserWalletInfo {
|
2023-07-14 18:50:55 +08:00
|
|
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
|
|
|
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
|
|
|
if (!uid.length) {
|
2023-11-02 11:14:35 +08:00
|
|
|
[[self getView]getUserWalletInfoFail];
|
2023-07-14 18:50:55 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
[Api getUserWalletInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
|
|
WalletInfoModel * model = [WalletInfoModel modelWithDictionary:data.data];
|
2023-11-02 11:14:35 +08:00
|
|
|
[[self getView] getUserWalletInfo:model];
|
2023-07-14 18:50:55 +08:00
|
|
|
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
2023-11-02 11:14:35 +08:00
|
|
|
[[self getView]getUserWalletInfoFail];
|
2023-07-14 18:50:55 +08:00
|
|
|
}] uid:uid ticket:ticket];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// 获取家族详细的信息
|
2023-11-02 11:14:35 +08:00
|
|
|
- (void)getClanDetailInfo {
|
2023-07-14 18:50:55 +08:00
|
|
|
NSString * uid = [[AccountInfoStorage instance] getUid];
|
|
|
|
if (!uid.length) {
|
2023-11-02 11:14:35 +08:00
|
|
|
[[self getView]onGetClanDetailInfofail];
|
2023-07-14 18:50:55 +08:00
|
|
|
return;
|
|
|
|
}
|
2024-05-17 16:57:28 +08:00
|
|
|
[Api getNewClanDetailInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
2023-07-14 18:50:55 +08:00
|
|
|
ClanDetailInfoModel * clanDetailInfo = [ClanDetailInfoModel modelWithDictionary:data.data];
|
2023-11-02 11:14:35 +08:00
|
|
|
[[self getView] onGetClanDetailInfoSuccess:clanDetailInfo];
|
2023-07-14 18:50:55 +08:00
|
|
|
}fail:^(NSInteger code, NSString * _Nullable msg) {
|
2023-11-02 11:14:35 +08:00
|
|
|
[[self getView]onGetClanDetailInfofail];
|
2023-07-14 18:50:55 +08:00
|
|
|
}] uid:uid];
|
|
|
|
}
|
|
|
|
|
|
|
|
///获取个人功能列表
|
2023-11-02 11:14:35 +08:00
|
|
|
- (void)getPersonItemList {
|
2023-07-14 18:50:55 +08:00
|
|
|
NSString * uid = [[AccountInfoStorage instance] getUid];
|
|
|
|
if (!uid.length){
|
2023-11-02 11:14:35 +08:00
|
|
|
[[self getView] onGetMineFuntionItemFail];
|
2023-07-14 18:50:55 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
[Api requestPersonalFunctionItem:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
|
|
NSArray *array = [XPMineFuntionItemModel modelsWithArray:data.data];
|
2023-11-02 11:14:35 +08:00
|
|
|
[[self getView] onGetMineFuntionItemSuccess:array ];
|
2023-07-14 18:50:55 +08:00
|
|
|
}fail:^(NSInteger code, NSString * _Nullable msg) {
|
2023-11-02 11:14:35 +08:00
|
|
|
[[self getView] onGetMineFuntionItemFail];
|
2023-07-14 18:50:55 +08:00
|
|
|
}] uid:uid];
|
|
|
|
}
|
2024-04-11 15:47:44 +08:00
|
|
|
///获取VIP信息
|
2023-11-02 11:14:35 +08:00
|
|
|
- (void)getNobleInfo {
|
2023-07-14 18:50:55 +08:00
|
|
|
[Api nobleCenterLevelList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
|
|
NobleCenterModel *model = [NobleCenterModel modelWithDictionary:data.data];
|
2023-11-02 11:14:35 +08:00
|
|
|
[[self getView] getNobleCenterInfoSuccess:model ];
|
2023-07-14 18:50:55 +08:00
|
|
|
}fail:^(NSInteger code, NSString * _Nullable msg) {
|
2023-11-02 11:14:35 +08:00
|
|
|
[[self getView] getNobleCenterInfoFail];
|
2023-07-14 18:50:55 +08:00
|
|
|
}]];
|
|
|
|
}
|
|
|
|
///获取个人中心banner
|
2023-11-02 11:14:35 +08:00
|
|
|
- (void)getMineBannerList {
|
2023-07-14 18:50:55 +08:00
|
|
|
NSString * uid = [[AccountInfoStorage instance] getUid];
|
|
|
|
if (!uid.length) {
|
2023-11-02 11:14:35 +08:00
|
|
|
[[self getView] onGetPersonalBannerListFail];
|
2023-07-14 18:50:55 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
[Api requestMineBannerList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
|
|
NSArray * array = [HomeBannerInfoModel modelsWithArray:data.data];
|
2023-11-02 11:14:35 +08:00
|
|
|
[[self getView] onGetPersonalBannerListSuccess:array];
|
2023-07-14 18:50:55 +08:00
|
|
|
}fail:^(NSInteger code, NSString * _Nullable msg) {
|
2023-11-02 11:14:35 +08:00
|
|
|
[[self getView] onGetPersonalBannerListFail];
|
2023-07-14 18:50:55 +08:00
|
|
|
} errorToast:NO] uid:uid type:@"10"];
|
|
|
|
}
|
2023-09-12 17:48:18 +08:00
|
|
|
|
2023-09-01 14:29:14 +08:00
|
|
|
///获取小游戏列表
|
2023-11-02 11:14:35 +08:00
|
|
|
- (void)getLittleGameList {
|
2023-09-01 14:29:14 +08:00
|
|
|
NSString * uid = [[AccountInfoStorage instance] getUid];
|
|
|
|
if (!uid.length) {
|
2023-11-02 11:14:35 +08:00
|
|
|
[[self getView] onGetLittleGameListFail];
|
2023-09-01 14:29:14 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
[Api getLittleGameList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
|
|
NSArray * array = [LittleGameInfoModel modelsWithArray:data.data];
|
2023-11-02 11:14:35 +08:00
|
|
|
[[self getView] onGetLittleGameListSuccess:array ];
|
2023-09-01 14:29:14 +08:00
|
|
|
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
2023-11-02 11:14:35 +08:00
|
|
|
[[self getView] onGetLittleGameListFail];
|
2023-09-01 14:29:14 +08:00
|
|
|
} errorToast:NO]];
|
|
|
|
}
|
|
|
|
///快速匹配小游戏房
|
|
|
|
/// @param mgId 游戏ID
|
|
|
|
- (void)quickMatchLittleGameWithMgId:(NSString *)mgId {
|
|
|
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
|
|
|
[Api requestMineQuickMatchLittleGame:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
|
|
HomeLittleGameRoomModel *gameRoom = [HomeLittleGameRoomModel modelWithDictionary:data.data];
|
|
|
|
[[self getView] quickMatchLittleGameRoomSuccess:gameRoom mgId:mgId];
|
|
|
|
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
|
|
|
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventusercenter_quick_entry_click eventAttributes:@{@"mgId" : mgId}];
|
|
|
|
}] uid:uid mgId:mgId];
|
|
|
|
}
|
2023-09-12 17:48:18 +08:00
|
|
|
|
2023-07-14 18:50:55 +08:00
|
|
|
@end
|