// // 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" #import "Api+LittleGame.h" ///Model #import "XPMineItemModel.h" #import "UserInfoModel.h" #import "ClanDetailInfoModel.h" #import "XPMineFunctionItemModel.h" #import "HomeBannerInfoModel.h" #import "WalletInfoModel.h" #import "ClanDetailInfoModel.h" #import "LittleGameInfoModel.h" #import "HomeLittleGameRoomModel.h" ///Protocol #import "XPMineProtocol.h" #import "Api+NobleCenter.h" #import "NobleCenterModel.h" @implementation XPMinePresent /// 获取用户信息 - (void)getUserInfo { NSString * uid = [[AccountInfoStorage instance] getUid]; if (uid.length == 0) { return; } @kWeakify(self); [Api getUserInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) { @kStrongify(self); UserInfoModel * infoModel = [UserInfoModel modelWithDictionary:data.data]; [[self getView] onGetUserInfoSuccess:infoModel]; } errorToast:NO] uid:uid]; } /// 获取钱包信息 - (void)getUserWalletInfo { NSString * uid = [AccountInfoStorage instance].getUid; NSString * ticket = [AccountInfoStorage instance].getTicket; if (!uid.length) { [[self getView] getUserWalletInfoFail]; return; } @kWeakify(self); [Api getUserWalletInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) { @kStrongify(self); WalletInfoModel * model = [WalletInfoModel modelWithDictionary:data.data]; [[self getView] getUserWalletInfo:model]; } fail:^(NSInteger code, NSString * _Nullable msg) { @kStrongify(self); [[self getView] getUserWalletInfoFail]; }] uid:uid ticket:ticket]; } /// 获取家族详细的信息 - (void)getClanDetailInfo { NSString * uid = [[AccountInfoStorage instance] getUid]; if (!uid.length) { // [[self getView]onGetClanDetailInfoFail]; return; } @kWeakify(self); [Api getNewClanDetailInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) { @kStrongify(self); ClanDetailMainInfoModel * clanDetailInfo = [ ClanDetailMainInfoModel modelWithDictionary:data.data]; [[self getView] onGetClanDetailInfoSuccess:clanDetailInfo]; }fail:^(NSInteger code, NSString * _Nullable msg) { // @kStrongify(self); // [[self getView]onGetClanDetailInfoFail]; NSLog(@"%@", msg); }] uid:uid]; } ///获取个人功能列表 - (void)getPersonItemList { NSString * uid = [[AccountInfoStorage instance] getUid]; if (!uid.length){ [[self getView] onGetMineFunctionsItemFail]; return; } @kWeakify(self); [Api requestPersonalFunctionItem:[self createHttpCompletion:^(BaseModel * _Nonnull data) { @kStrongify(self); NSArray *array = [XPMineFunctionItemModel modelsWithArray:data.data]; [[self getView] onGetMineFuntionItemSuccess:array]; }fail:^(NSInteger code, NSString * _Nullable msg) { @kStrongify(self); [[self getView] onGetMineFunctionsItemFail]; }] uid:uid]; } ///获取VIP信息 - (void)getNobleInfo { @kWeakify(self); [Api vipCenterLevelList:[self createHttpCompletion:^(BaseModel * _Nonnull data) { @kStrongify(self); NobleCenterModel *model = [NobleCenterModel modelWithDictionary:data.data]; [[self getView] getNobleCenterInfoSuccess:model ]; }fail:^(NSInteger code, NSString * _Nullable msg) { @kStrongify(self); [[self getView] getNobleCenterInfoFail]; }]]; } ///获取个人中心banner - (void)getMineBannerList { NSString * uid = [[AccountInfoStorage instance] getUid]; if (!uid.length) { [[self getView] onGetPersonalBannerListFail]; return; } @kWeakify(self); [Api requestMineBannerList:[self createHttpCompletion:^(BaseModel * _Nonnull data) { @kStrongify(self); NSArray * array = [HomeBannerInfoModel modelsWithArray:data.data]; [[self getView] onGetPersonalBannerListSuccess:array]; }fail:^(NSInteger code, NSString * _Nullable msg) { @kStrongify(self); [[self getView] onGetPersonalBannerListFail]; } errorToast:NO] uid:uid type:@"10"]; } @end