Files
peko-ios/YuMi/Modules/YMMine/View/Noble/Presenter/XPNobleCenterPresenter.m

130 lines
5.2 KiB
Mathematica
Raw Normal View History

2023-07-14 18:50:55 +08:00
//
// XPNobleCenterPresenter.m
// xplan-ios
//
// Created by GreenLand on 2022/1/3.
//
#import "XPNobleCenterPresenter.h"
///Api
#import "Api+NobleCenter.h"
#import "Api+Mine.h"
2023-09-21 17:44:59 +08:00
2023-07-14 18:50:55 +08:00
///Tool
#import "AccountInfoStorage.h"
#import "YYUtility.h"
///Model
#import "NobleCenterModel.h"
#import "UserInfoModel.h"
#import "NobleRechargeModel.h"
///P
#import "XPNobleCenterProtocol.h"
@implementation XPNobleCenterPresenter
2024-04-11 15:47:44 +08:00
/// VIP
2023-07-14 18:50:55 +08:00
- (void)getNobleCenterInfo {
2024-09-12 14:01:12 +08:00
[Api vipCenterLevelList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
2023-07-14 18:50:55 +08:00
NobleCenterModel *model = [NobleCenterModel modelWithDictionary:data.data];
[[self getView] getNobleCenterInfoSuccess:model];
}]];
}
2024-04-11 15:47:44 +08:00
/// VIP
2024-03-29 19:18:58 +08:00
- (void)getNobleCenterReturnDiamond:(NSString *)recordId{
[Api getNobleCenterDiamond:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView]getNobleCenterDiamondSuccess:recordId];
} showLoading:YES errorToast:YES] returnProfitRecordId:recordId];
}
2023-07-14 18:50:55 +08:00
//
- (void)getUserInfo {
NSString * uid = [[AccountInfoStorage instance] getUid];
[Api getUserInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
UserInfoModel * infoModel = [UserInfoModel modelWithDictionary:data.data];
[[self getView] onGetUserInfoSuccess:infoModel];
} fail:^(NSInteger code, NSString * _Nullable msg) {
}] uid:uid];
}
2024-04-11 15:47:44 +08:00
///VIP
2024-03-29 19:18:58 +08:00
- (void)getNobleChargeProductListWithChannelType:(NSString *)type {
@kWeakify(self);
2023-07-14 18:50:55 +08:00
[Api getChargeList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
2024-03-29 19:18:58 +08:00
NSArray *list = [RechargeListModel modelsWithArray:data.data];
[[self getView] onGetNobleRechargeDataSuccess:list];
}fail:^(NSInteger code, NSString * _Nullable msg) {
}] type:type];
2023-07-14 18:50:55 +08:00
}
2024-04-11 15:47:44 +08:00
/// VIP
2023-07-14 18:50:55 +08:00
/// @param chargeProdId id
- (void)requestNobleIAPRechargeOrderWithChargeProdId:(NSString *)chargeProdId roomUid:(NSString *)roomUid {
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [AccountInfoStorage instance].getTicket;
NSString * deviceInfo = [YYUtility deviceID];
NSString * clientIp= [YYUtility ipAddress];
[Api requestNobleIAPRecharge:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
NSString *orderId = (NSString *)data.data[@"recordId"];
NSString *uuid = (NSString *)data.data[@"appAccountToken"];
[[self getView] requestIAPRechargeOrderSuccess:orderId chargeProdId:chargeProdId uuid:uuid];
2023-07-14 18:50:55 +08:00
} fail:^(NSInteger code, NSString * _Nullable msg) {
[[self getView] requestIAPRechargeOrderFail:msg code:code];
2023-09-25 16:46:57 +08:00
}showLoading:NO errorToast:NO] chargeProdId:chargeProdId uid:uid roomUid:roomUid ticket:ticket deviceInfo:deviceInfo clientIp:clientIp];
2023-07-14 18:50:55 +08:00
}
///
2023-07-14 18:50:55 +08:00
/// @param orderId
/// @param transcationId id
- (void)checkReceiptWithOrderId:(NSString *)orderId transcationId:(NSString *)transcationId errorToast:(BOOL)errorToast{
2023-07-14 18:50:55 +08:00
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [AccountInfoStorage instance].getTicket;
[Api checkReceipt:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] checkReceiptSuccess:transcationId];
}fail:^(NSInteger code, NSString * _Nullable msg) {
[[self getView]checkReceiptFailWithCode:code transcationId:transcationId];
} showLoading:YES errorToast:errorToast] chooseEnv:@"true" chargeRecordId:orderId transcationId:transcationId uid:uid ticket:ticket];
2023-07-14 18:50:55 +08:00
}
///
/// @param transcations
- (void)checkTranscationIds:(NSArray *)transcations {
NSString * transcationIdStr = [transcations toJSONString];
[Api requestCheckTranscationIds:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] checkTranscationIdsSuccess];
}] transcationIdStr:transcationIdStr];
}
///
/// @param enterHide
- (void)changeEnterHide:(BOOL)enterHide {
[Api changeEnterHidCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] changeEnterHideSuccess];
} fail:^(NSInteger code, NSString * _Nullable msg) {
[[self getView] changeEnterHideFail];
}] open:[NSString stringWithFormat:@"%d", enterHide]];
}
2024-04-11 15:47:44 +08:00
/// 使VIP
2023-07-14 18:50:55 +08:00
/// @param roomUid uid
2024-03-29 19:18:58 +08:00
- (void)openVipWithDiamondRoomUid:(NSString *)roomUid vipLevel:(NSString *)vipLevel{
2023-07-14 18:50:55 +08:00
[Api openWithDiamond:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] openVipWithDiamondSuccess];
} fail:^(NSInteger code, NSString * _Nullable msg) {
2024-03-29 19:18:58 +08:00
[[self getView] openVipWithDiamondFail:code];
}showLoading:YES errorToast:YES] roomUid:roomUid vipLevel:vipLevel];
2023-07-14 18:50:55 +08:00
}
2023-09-21 17:44:59 +08:00
//
-(void)getContactCustomerService{
[Api requestContactCustomerServiceCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
NSString *uid = [NSString stringWithFormat:@"%@",data.data];
[[self getView]getContactCustomerServiceSuccessWithUid:uid];
} fail:^(NSInteger code, NSString * _Nullable msg) {
} showLoading:YES errorToast:NO]];
}
2023-07-14 18:50:55 +08:00
@end