Compare commits
12 Commits
hotfix/1.2
...
appstore_1
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c5a6e45c7c | ||
![]() |
a98ece29f6 | ||
![]() |
57b112bb09 | ||
![]() |
2bf7626def | ||
![]() |
d66dd68242 | ||
![]() |
34f328115a | ||
![]() |
7cf333572e | ||
![]() |
e4de2f78a1 | ||
![]() |
f4f413c374 | ||
![]() |
367851d971 | ||
![]() |
7ebc65dfa0 | ||
![]() |
9182cdedcf |
@@ -130,6 +130,7 @@
|
|||||||
18F404BB2760982000A6C548 /* ChatLimitModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F404BA2760982000A6C548 /* ChatLimitModel.m */; };
|
18F404BB2760982000A6C548 /* ChatLimitModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F404BA2760982000A6C548 /* ChatLimitModel.m */; };
|
||||||
18F404C3276098F100A6C548 /* Api+Message.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F404C2276098F100A6C548 /* Api+Message.m */; };
|
18F404C3276098F100A6C548 /* Api+Message.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F404C2276098F100A6C548 /* Api+Message.m */; };
|
||||||
18F404C927609A4300A6C548 /* MessagePresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F404C827609A4300A6C548 /* MessagePresenter.m */; };
|
18F404C927609A4300A6C548 /* MessagePresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F404C827609A4300A6C548 /* MessagePresenter.m */; };
|
||||||
|
232C44492AB31CD700D4B2ED /* PIIAPPayment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 232C44482AB31CD700D4B2ED /* PIIAPPayment.swift */; };
|
||||||
2331C0DC2A5E9E9000E1D940 /* PIFullScreenBannerAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 2331C0DB2A5E9E9000E1D940 /* PIFullScreenBannerAnimation.m */; };
|
2331C0DC2A5E9E9000E1D940 /* PIFullScreenBannerAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 2331C0DB2A5E9E9000E1D940 /* PIFullScreenBannerAnimation.m */; };
|
||||||
2331C1632A5EB71000E1D940 /* XPNobleCenterPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 2331C1322A5EB71000E1D940 /* XPNobleCenterPresenter.m */; };
|
2331C1632A5EB71000E1D940 /* XPNobleCenterPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 2331C1322A5EB71000E1D940 /* XPNobleCenterPresenter.m */; };
|
||||||
2331C1642A5EB71000E1D940 /* NobleInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 2331C1362A5EB71000E1D940 /* NobleInfo.m */; };
|
2331C1642A5EB71000E1D940 /* NobleInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 2331C1362A5EB71000E1D940 /* NobleInfo.m */; };
|
||||||
@@ -1589,6 +1590,7 @@
|
|||||||
18F404C6276099DF00A6C548 /* MessageProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessageProtocol.h; sourceTree = "<group>"; };
|
18F404C6276099DF00A6C548 /* MessageProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessageProtocol.h; sourceTree = "<group>"; };
|
||||||
18F404C727609A4300A6C548 /* MessagePresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessagePresenter.h; sourceTree = "<group>"; };
|
18F404C727609A4300A6C548 /* MessagePresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessagePresenter.h; sourceTree = "<group>"; };
|
||||||
18F404C827609A4300A6C548 /* MessagePresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessagePresenter.m; sourceTree = "<group>"; };
|
18F404C827609A4300A6C548 /* MessagePresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessagePresenter.m; sourceTree = "<group>"; };
|
||||||
|
232C44482AB31CD700D4B2ED /* PIIAPPayment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PIIAPPayment.swift; sourceTree = "<group>"; };
|
||||||
2331C0DA2A5E9E9000E1D940 /* PIFullScreenBannerAnimation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PIFullScreenBannerAnimation.h; sourceTree = "<group>"; };
|
2331C0DA2A5E9E9000E1D940 /* PIFullScreenBannerAnimation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PIFullScreenBannerAnimation.h; sourceTree = "<group>"; };
|
||||||
2331C0DB2A5E9E9000E1D940 /* PIFullScreenBannerAnimation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PIFullScreenBannerAnimation.m; sourceTree = "<group>"; };
|
2331C0DB2A5E9E9000E1D940 /* PIFullScreenBannerAnimation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PIFullScreenBannerAnimation.m; sourceTree = "<group>"; };
|
||||||
2331C1312A5EB71000E1D940 /* XPNobleCenterPresenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPNobleCenterPresenter.h; sourceTree = "<group>"; };
|
2331C1312A5EB71000E1D940 /* XPNobleCenterPresenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPNobleCenterPresenter.h; sourceTree = "<group>"; };
|
||||||
@@ -4442,6 +4444,7 @@
|
|||||||
189DD5A726DFA09700AB55B1 /* Tools */ = {
|
189DD5A726DFA09700AB55B1 /* Tools */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
232C44452AB31C7C00D4B2ED /* PIIAPTool */,
|
||||||
23E9EA9B2A84C42B00B792F2 /* SGYProgressView */,
|
23E9EA9B2A84C42B00B792F2 /* SGYProgressView */,
|
||||||
23E9E9AB2A81E8E900B792F2 /* Event */,
|
23E9E9AB2A81E8E900B792F2 /* Event */,
|
||||||
E83645A42A40AEF600E0DBE4 /* Bundle */,
|
E83645A42A40AEF600E0DBE4 /* Bundle */,
|
||||||
@@ -4677,6 +4680,14 @@
|
|||||||
path = Protocol;
|
path = Protocol;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
232C44452AB31C7C00D4B2ED /* PIIAPTool */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
232C44482AB31CD700D4B2ED /* PIIAPPayment.swift */,
|
||||||
|
);
|
||||||
|
path = PIIAPTool;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
2331C12F2A5EB71000E1D940 /* Noble */ = {
|
2331C12F2A5EB71000E1D940 /* Noble */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@@ -4813,14 +4824,14 @@
|
|||||||
2331C1882A60F32D00E1D940 /* Model */ = {
|
2331C1882A60F32D00E1D940 /* Model */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
2331C1892A60F32D00E1D940 /* CandyTreeResultModel.m */,
|
|
||||||
2331C18A2A60F32D00E1D940 /* CandyTreeRecordModel.m */,
|
|
||||||
2331C18B2A60F32D00E1D940 /* XPCandyTreeAnimationModel.h */,
|
|
||||||
2331C18C2A60F32D00E1D940 /* CandyTreeInfoModel.h */,
|
2331C18C2A60F32D00E1D940 /* CandyTreeInfoModel.h */,
|
||||||
2331C18D2A60F32D00E1D940 /* XPCandyTreeAnimationModel.m */,
|
|
||||||
2331C18E2A60F32D00E1D940 /* CandyTreeRecordModel.h */,
|
|
||||||
2331C18F2A60F32D00E1D940 /* CandyTreeResultModel.h */,
|
|
||||||
2331C1902A60F32D00E1D940 /* CandyTreeInfoModel.m */,
|
2331C1902A60F32D00E1D940 /* CandyTreeInfoModel.m */,
|
||||||
|
2331C18E2A60F32D00E1D940 /* CandyTreeRecordModel.h */,
|
||||||
|
2331C18A2A60F32D00E1D940 /* CandyTreeRecordModel.m */,
|
||||||
|
2331C18F2A60F32D00E1D940 /* CandyTreeResultModel.h */,
|
||||||
|
2331C1892A60F32D00E1D940 /* CandyTreeResultModel.m */,
|
||||||
|
2331C18B2A60F32D00E1D940 /* XPCandyTreeAnimationModel.h */,
|
||||||
|
2331C18D2A60F32D00E1D940 /* XPCandyTreeAnimationModel.m */,
|
||||||
);
|
);
|
||||||
path = Model;
|
path = Model;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -10337,6 +10348,7 @@
|
|||||||
E81366E326F0A1FC0076364C /* LoginBindPhoneViewController.m in Sources */,
|
E81366E326F0A1FC0076364C /* LoginBindPhoneViewController.m in Sources */,
|
||||||
1464C5F329A4C18000AF7C94 /* XPIAPRechargeViewController.m in Sources */,
|
1464C5F329A4C18000AF7C94 /* XPIAPRechargeViewController.m in Sources */,
|
||||||
E85E7B662A4EC35A00B6D00A /* XPIncomeRecordGoldDetailsModel.m in Sources */,
|
E85E7B662A4EC35A00B6D00A /* XPIncomeRecordGoldDetailsModel.m in Sources */,
|
||||||
|
232C44492AB31CD700D4B2ED /* PIIAPPayment.swift in Sources */,
|
||||||
9B2EA7CC2804245500ED17BF /* XPAnchorPKPanelUserView.m in Sources */,
|
9B2EA7CC2804245500ED17BF /* XPAnchorPKPanelUserView.m in Sources */,
|
||||||
2331C1B42A60F32D00E1D940 /* XPCandyTreeRankTableViewCell.m in Sources */,
|
2331C1B42A60F32D00E1D940 /* XPCandyTreeRankTableViewCell.m in Sources */,
|
||||||
9B85B6DA279FDC5200A0A1AC /* XPUserCardSkillCollectionViewCell.m in Sources */,
|
9B85B6DA279FDC5200A0A1AC /* XPUserCardSkillCollectionViewCell.m in Sources */,
|
||||||
@@ -11190,10 +11202,11 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 10.13;
|
MARKETING_VERSION = 10.13.3;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.peko.enterprise.ios;
|
PRODUCT_BUNDLE_IDENTIFIER = com.peko.enterprise.ios;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
TARGETED_DEVICE_FAMILY = 1;
|
TARGETED_DEVICE_FAMILY = 1;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
@@ -11223,10 +11236,11 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 10.13;
|
MARKETING_VERSION = 10.13.3;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.peko.enterprise.ios;
|
PRODUCT_BUNDLE_IDENTIFIER = com.peko.enterprise.ios;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
TARGETED_DEVICE_FAMILY = 1;
|
TARGETED_DEVICE_FAMILY = 1;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "room_background .png",
|
"filename" : "room_background.png",
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 324 KiB |
BIN
YuMi/Assets.xcassets/yna/room_background.imageset/room_background.png
vendored
Normal file
BIN
YuMi/Assets.xcassets/yna/room_background.imageset/room_background.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 83 KiB |
@@ -5,6 +5,8 @@
|
|||||||
// Created by YUMI on 2021/9/10.
|
// Created by YUMI on 2021/9/10.
|
||||||
//
|
//
|
||||||
///一些宏
|
///一些宏
|
||||||
|
#import "NSBundle+Localizable.h"
|
||||||
|
|
||||||
#ifndef YUMIMacroUitls_h
|
#ifndef YUMIMacroUitls_h
|
||||||
#define YUMIMacroUitls_h
|
#define YUMIMacroUitls_h
|
||||||
|
|
||||||
@@ -49,7 +51,7 @@ isPhoneXSeries = [[UIApplication sharedApplication] delegate].window.safeAreaIns
|
|||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define API_HOST_URL [NSString stringWithFormat:@"%@%@",@"https://beta.api",@".pekolive.com"]
|
#define API_HOST_URL [NSString stringWithFormat:@"%@%@",@"http://beta.api",@".pekolive.com"]
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@@ -58,7 +60,7 @@ isPhoneXSeries = [[UIApplication sharedApplication] delegate].window.safeAreaIns
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define API_Image_URL @"https://image.hfighting.com"
|
#define API_Image_URL @"https://image.hfighting.com"
|
||||||
#import "NSBundle+Localizable.h"
|
|
||||||
#define YMLocalizedString(key) \
|
#define YMLocalizedString(key) \
|
||||||
[NSBundle ymLocalizedStringForKey:(key)]
|
[NSBundle ymLocalizedStringForKey:(key)]
|
||||||
#endif /* YUMIMacroUitls_h */
|
#endif /* YUMIMacroUitls_h */
|
||||||
|
@@ -164,7 +164,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/// @param uid 用户uid
|
/// @param uid 用户uid
|
||||||
/// @param ticket ticket
|
/// @param ticket ticket
|
||||||
+ (void)checkReceipt:(HttpRequestHelperCompletion)complection
|
+ (void)checkReceipt:(HttpRequestHelperCompletion)complection
|
||||||
receipt:(NSString *)receipt
|
|
||||||
chooseEnv:(NSString *)chooseEnv
|
chooseEnv:(NSString *)chooseEnv
|
||||||
chargeRecordId:(NSString *)chargeRecordId
|
chargeRecordId:(NSString *)chargeRecordId
|
||||||
transcationId:(NSString *)transcationId
|
transcationId:(NSString *)transcationId
|
||||||
|
@@ -178,22 +178,21 @@
|
|||||||
/// @param deviceInfo uuid
|
/// @param deviceInfo uuid
|
||||||
/// @param clientIp ip地址
|
/// @param clientIp ip地址
|
||||||
+ (void)requestIAPRecharge:(HttpRequestHelperCompletion)completion chargeProdId:(NSString *)chargeProdId uid:(NSString *)uid ticket:(NSString *)ticket deviceInfo:(NSString *)deviceInfo clientIp:(NSString *)clientIp {
|
+ (void)requestIAPRecharge:(HttpRequestHelperCompletion)completion chargeProdId:(NSString *)chargeProdId uid:(NSString *)uid ticket:(NSString *)ticket deviceInfo:(NSString *)deviceInfo clientIp:(NSString *)clientIp {
|
||||||
NSString * fang = [NSString stringFromBase64String:@"b3JkZXIvcGxhY2VWMg=="];///order/placeV2
|
|
||||||
[self makeRequest:fang method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__,chargeProdId, uid, ticket, deviceInfo, clientIp, nil];
|
[self makeRequest:@"storeKitV2/placeOrder" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__,chargeProdId, uid, ticket, deviceInfo, clientIp, nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// 验证凭据
|
/// 验证凭据
|
||||||
/// @param completion 完成
|
/// @param completion 完成
|
||||||
/// @param receipt base 64 recepit
|
|
||||||
/// @param chooseEnv @"true"
|
/// @param chooseEnv @"true"
|
||||||
/// @param chargeRecordId 服务端生成的订单编号
|
/// @param chargeRecordId 服务端生成的订单编号
|
||||||
/// @param transcationId 内购的唯一标识符
|
/// @param transcationId 内购的唯一标识符
|
||||||
/// @param uid 用户uid
|
/// @param uid 用户uid
|
||||||
/// @param ticket ticket
|
/// @param ticket ticket
|
||||||
+ (void)checkReceipt:(HttpRequestHelperCompletion)completion receipt:(NSString *)receipt chooseEnv:(NSString *)chooseEnv chargeRecordId:(NSString *)chargeRecordId transcationId:(NSString *)transcationId uid:(NSString *)uid ticket:(NSString *)ticket {
|
+ (void)checkReceipt:(HttpRequestHelperCompletion)completion chooseEnv:(NSString *)chooseEnv chargeRecordId:(NSString *)chargeRecordId transcationId:(NSString *)transcationId uid:(NSString *)uid ticket:(NSString *)ticket {
|
||||||
NSString * fang = [NSString stringFromBase64String:@"dmVyaWZ5L3NldGlhcA=="];///verify/setiap
|
|
||||||
[self makeRequest:fang method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__,receipt, chooseEnv, chargeRecordId, transcationId, uid, ticket, nil];
|
[self makeRequest:@"storeKitV2/verifyOrder" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, chooseEnv, chargeRecordId, transcationId, uid, ticket, nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -32,7 +32,8 @@ typedef NS_ENUM(NSInteger, XPMineItemType) {
|
|||||||
XPMineItemType_FansTeam = 72,///粉丝团
|
XPMineItemType_FansTeam = 72,///粉丝团
|
||||||
XPMineItemType_DressUp_Market = 73, ///装扮商场
|
XPMineItemType_DressUp_Market = 73, ///装扮商场
|
||||||
XPMineItemType_My_Dressup = 74,///我的装扮
|
XPMineItemType_My_Dressup = 74,///我的装扮
|
||||||
XPMineItemType_My_Set = 75///设置
|
XPMineItemType_My_Set = 75,///设置
|
||||||
|
XPMineItemType_My_Refund = 76///设置
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -22,10 +22,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
- (void)requestIAPRechargeOrderWithChargeProdId:(NSString *)chargeProdId;
|
- (void)requestIAPRechargeOrderWithChargeProdId:(NSString *)chargeProdId;
|
||||||
|
|
||||||
/// 充值成功二次验证
|
/// 充值成功二次验证
|
||||||
/// @param receipt 凭据
|
|
||||||
/// @param orderId 订单编号
|
/// @param orderId 订单编号
|
||||||
/// @param transcationId 商品id
|
/// @param transcationId 商品id
|
||||||
- (void)checkReceiptWithData:(NSString *)receipt orderId:(NSString *)orderId transcationId:(NSString *)transcationId;
|
- (void)checkReceiptWithOrderId:(NSString *)orderId transcationId:(NSString *)transcationId errorToast:(BOOL)errorToast;
|
||||||
|
|
||||||
/// 批量验证内购掉单
|
/// 批量验证内购掉单
|
||||||
/// @param transcations 凭据的数组
|
/// @param transcations 凭据的数组
|
||||||
|
@@ -50,7 +50,8 @@
|
|||||||
NSString * clientIp= [YYUtility ipAddress];
|
NSString * clientIp= [YYUtility ipAddress];
|
||||||
[Api requestIAPRecharge:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
[Api requestIAPRecharge:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||||
NSString *orderId = (NSString *)data.data[@"recordId"];
|
NSString *orderId = (NSString *)data.data[@"recordId"];
|
||||||
[[self getView] requestIAPRechargeOrderSuccess:orderId chargeProdId:chargeProdId];
|
NSString *uuid = (NSString *)data.data[@"appAccountToken"];
|
||||||
|
[[self getView] requestIAPRechargeOrderSuccess:orderId chargeProdId:chargeProdId uuid:uuid];
|
||||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||||
[[self getView] requestIAPRechargeOrderFail];
|
[[self getView] requestIAPRechargeOrderFail];
|
||||||
}] chargeProdId:chargeProdId uid:uid ticket:ticket deviceInfo:deviceInfo clientIp:clientIp];
|
}] chargeProdId:chargeProdId uid:uid ticket:ticket deviceInfo:deviceInfo clientIp:clientIp];
|
||||||
@@ -58,17 +59,16 @@
|
|||||||
|
|
||||||
|
|
||||||
/// 充值成功二次验证
|
/// 充值成功二次验证
|
||||||
/// @param receipt 凭据
|
|
||||||
/// @param orderId 订单编号
|
/// @param orderId 订单编号
|
||||||
/// @param transcationId 商品id
|
/// @param transcationId 商品id
|
||||||
- (void)checkReceiptWithData:(NSString *)receipt orderId:(NSString *)orderId transcationId:(NSString *)transcationId {
|
- (void)checkReceiptWithOrderId:(NSString *)orderId transcationId:(NSString *)transcationId errorToast:(BOOL)errorToast{
|
||||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||||
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
||||||
[Api checkReceipt:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
[Api checkReceipt:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||||
[[self getView] checkReceiptSuccess:transcationId];
|
[[self getView] checkReceiptSuccess:transcationId];
|
||||||
}fail:^(NSInteger code, NSString * _Nullable msg) {
|
}fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||||
[[self getView]hideHUD];
|
[[self getView]checkReceiptFailWithCode:code transcationId:transcationId];
|
||||||
} showLoading:YES] receipt:receipt chooseEnv:@"true" chargeRecordId:orderId transcationId:transcationId uid:uid ticket:ticket];
|
} showLoading:NO errorToast:errorToast] chooseEnv:@"true" chargeRecordId:orderId transcationId:transcationId uid:uid ticket:ticket];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -15,11 +15,13 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
///请求充值列表成功
|
///请求充值列表成功
|
||||||
- (void)requestRechargeListSucccess:(NSArray *)list;
|
- (void)requestRechargeListSucccess:(NSArray *)list;
|
||||||
///请求充值id的状态成功
|
///请求充值id的状态成功
|
||||||
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId;
|
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId uuid:(NSString *)uuid;
|
||||||
///请求充值账单失败
|
///请求充值账单失败
|
||||||
- (void)requestIAPRechargeOrderFail;
|
- (void)requestIAPRechargeOrderFail;
|
||||||
///二次校验成功
|
///二次校验成功
|
||||||
- (void)checkReceiptSuccess:(NSString *)transcationId;
|
- (void)checkReceiptSuccess:(NSString *)transcationId;
|
||||||
|
///二次校验失败
|
||||||
|
- (void)checkReceiptFailWithCode:(NSInteger)code transcationId:(NSString *)transcationId;
|
||||||
///批量验证凭据成功
|
///批量验证凭据成功
|
||||||
- (void)checkTranscationIdsSuccess;
|
- (void)checkTranscationIdsSuccess;
|
||||||
@end
|
@end
|
||||||
|
@@ -137,16 +137,16 @@
|
|||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
|
||||||
NSString * myUid = [AccountInfoStorage instance].getUid;
|
// NSString * myUid = [AccountInfoStorage instance].getUid;
|
||||||
if(![self.clanInfo.clan.elderUid isEqualToString:myUid]){
|
// if(![self.clanInfo.clan.elderUid isEqualToString:myUid]){
|
||||||
XPWebViewController * webVC =[[XPWebViewController alloc] init];
|
XPWebViewController * webVC =[[XPWebViewController alloc] init];
|
||||||
webVC.url = URLWithType(kGoldEarningsRecord);
|
webVC.url = URLWithType(kGoldEarningsRecord);
|
||||||
[self.navigationController pushViewController:webVC animated:YES];
|
[self.navigationController pushViewController:webVC animated:YES];
|
||||||
return;
|
// return;
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
XPIncomeRecordGoldDetailsVC *goldDetailVC = [XPIncomeRecordGoldDetailsVC new];
|
// XPIncomeRecordGoldDetailsVC *goldDetailVC = [XPIncomeRecordGoldDetailsVC new];
|
||||||
[self.navigationController pushViewController:goldDetailVC animated:YES];
|
// [self.navigationController pushViewController:goldDetailVC animated:YES];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -38,7 +38,7 @@
|
|||||||
if (!roomUid) {
|
if (!roomUid) {
|
||||||
roomUid = NULL;
|
roomUid = NULL;
|
||||||
}
|
}
|
||||||
[self makeRequest:@"order/placeV2" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__,chargeProdId, uid, roomUid, ticket, deviceInfo, clientIp, nil];
|
[self makeRequest:@"storeKitV2/placeOrder" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__,chargeProdId, uid, roomUid, ticket, deviceInfo, clientIp, nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 一键还原装扮
|
/// 一键还原装扮
|
||||||
|
@@ -25,10 +25,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
- (void)requestNobleIAPRechargeOrderWithChargeProdId:(NSString *)chargeProdId roomUid:(NSString *)roomUid ;
|
- (void)requestNobleIAPRechargeOrderWithChargeProdId:(NSString *)chargeProdId roomUid:(NSString *)roomUid ;
|
||||||
|
|
||||||
/// 充值成功二次验证
|
/// 充值成功二次验证
|
||||||
/// @param receipt 凭据
|
|
||||||
/// @param orderId 订单编号
|
/// @param orderId 订单编号
|
||||||
/// @param transcationId 商品id
|
/// @param transcationId 商品id
|
||||||
- (void)checkReceiptWithData:(NSString *)receipt orderId:(NSString *)orderId transcationId:(NSString *)transcationId;
|
- (void)checkReceiptWithOrderId:(NSString *)orderId transcationId:(NSString *)transcationId errorToast:(BOOL)errorToast;
|
||||||
|
|
||||||
/// 批量验证内购掉单
|
/// 批量验证内购掉单
|
||||||
/// @param transcations 凭据的数组
|
/// @param transcations 凭据的数组
|
||||||
|
@@ -58,22 +58,25 @@
|
|||||||
NSString * clientIp= [YYUtility ipAddress];
|
NSString * clientIp= [YYUtility ipAddress];
|
||||||
[Api requestNobleIAPRecharge:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
[Api requestNobleIAPRecharge:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||||
NSString *orderId = (NSString *)data.data[@"recordId"];
|
NSString *orderId = (NSString *)data.data[@"recordId"];
|
||||||
[[self getView] requestIAPRechargeOrderSuccess:orderId chargeProdId:chargeProdId];
|
NSString *uuid = (NSString *)data.data[@"appAccountToken"];
|
||||||
|
[[self getView] requestIAPRechargeOrderSuccess:orderId chargeProdId:chargeProdId uuid:uuid];
|
||||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||||
[[self getView] requestIAPRechargeOrderFail:msg code:code];
|
[[self getView] requestIAPRechargeOrderFail:msg code:code];
|
||||||
} errorToast:YES] chargeProdId:chargeProdId uid:uid roomUid:roomUid ticket:ticket deviceInfo:deviceInfo clientIp:clientIp];
|
} errorToast:YES] chargeProdId:chargeProdId uid:uid roomUid:roomUid ticket:ticket deviceInfo:deviceInfo clientIp:clientIp];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 充值成功二次验证
|
/// 充值成功二次验证
|
||||||
/// @param receipt 凭据
|
|
||||||
/// @param orderId 订单编号
|
/// @param orderId 订单编号
|
||||||
/// @param transcationId 商品id
|
/// @param transcationId 商品id
|
||||||
- (void)checkReceiptWithData:(NSString *)receipt orderId:(NSString *)orderId transcationId:(NSString *)transcationId {
|
- (void)checkReceiptWithOrderId:(NSString *)orderId transcationId:(NSString *)transcationId errorToast:(BOOL)errorToast{
|
||||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||||
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
||||||
[Api checkReceipt:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
[Api checkReceipt:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||||
[[self getView] checkReceiptSuccess:transcationId];
|
[[self getView] checkReceiptSuccess:transcationId];
|
||||||
} showLoading:YES] receipt:receipt chooseEnv:@"true" chargeRecordId:orderId transcationId:transcationId uid:uid ticket:ticket];
|
}fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||||
|
[[self getView]hideHUD];
|
||||||
|
} showLoading:YES errorToast:errorToast] chooseEnv:@"true" chargeRecordId:orderId transcationId:transcationId uid:uid ticket:ticket];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 批量验证内购掉单
|
/// 批量验证内购掉单
|
||||||
|
@@ -20,13 +20,14 @@
|
|||||||
- (void)onGetNobleRechargeDataSuccess:(NobleRechargeModel *)rechargeInfo;
|
- (void)onGetNobleRechargeDataSuccess:(NobleRechargeModel *)rechargeInfo;
|
||||||
|
|
||||||
///请求充值id的状态成功
|
///请求充值id的状态成功
|
||||||
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId;
|
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId uuid:(NSString *)uuid;
|
||||||
///请求充值账单失败
|
///请求充值账单失败
|
||||||
- (void)requestIAPRechargeOrderFail:(NSString *)message code:(NSInteger)code;
|
- (void)requestIAPRechargeOrderFail:(NSString *)message code:(NSInteger)code;
|
||||||
|
|
||||||
///二次校验成功
|
///二次校验成功
|
||||||
- (void)checkReceiptSuccess:(NSString *)transcationId;
|
- (void)checkReceiptSuccess:(NSString *)transcationId;
|
||||||
|
///二次校验失败
|
||||||
|
- (void)checkReceiptFailWithCode:(NSInteger)code transcationId:(NSString *)transcationId;
|
||||||
///批量验证凭据成功
|
///批量验证凭据成功
|
||||||
- (void)checkTranscationIdsSuccess;
|
- (void)checkTranscationIdsSuccess;
|
||||||
|
|
||||||
|
@@ -141,7 +141,7 @@
|
|||||||
self.descLabel.text = [NSString stringWithFormat:YMLocalizedString(@"XPNobleCenterEntranceView0"), value];
|
self.descLabel.text = [NSString stringWithFormat:YMLocalizedString(@"XPNobleCenterEntranceView0"), value];
|
||||||
self.descLabel.textColor = UIColorFromRGB(0x5E4D98);
|
self.descLabel.textColor = UIColorFromRGB(0x5E4D98);
|
||||||
self.nextLevelLabel.text = nextLevelName;
|
self.nextLevelLabel.text = nextLevelName;
|
||||||
|
self.descLabel.hidden = nobleInfo.currLevel >= 9;
|
||||||
CGFloat margin = self.backProgressView.frame.size.width * (nobleInfo.currScore * 1.0 / (nextScore > 0 ? nextScore : 1));
|
CGFloat margin = self.backProgressView.frame.size.width * (nobleInfo.currScore * 1.0 / (nextScore > 0 ? nextScore : 1));
|
||||||
[self.currentProgressView mas_updateConstraints:^(MASConstraintMaker *make) {
|
[self.currentProgressView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||||
make.trailing.mas_equalTo(self.backProgressView.mas_leading).mas_offset(margin);
|
make.trailing.mas_equalTo(self.backProgressView.mas_leading).mas_offset(margin);
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
#import "ThemeColor+NobleCenter.h"
|
#import "ThemeColor+NobleCenter.h"
|
||||||
#import "Api+NobleCenter.h"
|
#import "Api+NobleCenter.h"
|
||||||
|
|
||||||
#import "XPIAPHelper.h"
|
|
||||||
#import "RechargeStorage.h"
|
#import "RechargeStorage.h"
|
||||||
#import "AccountInfoStorage.h"
|
#import "AccountInfoStorage.h"
|
||||||
#import "UIImage+Utils.h"
|
#import "UIImage+Utils.h"
|
||||||
@@ -43,7 +43,8 @@
|
|||||||
#import "XPNobleCenterPayView.h"
|
#import "XPNobleCenterPayView.h"
|
||||||
#import "XPNobleCenterProtocol.h"
|
#import "XPNobleCenterProtocol.h"
|
||||||
#import "XPIAPRechargeViewController.h"
|
#import "XPIAPRechargeViewController.h"
|
||||||
@interface XPNobleCenterViewController ()<XPNobleCenterProtocol,XPNobleCenterPayViewDelegate,JXCategoryViewDelegate, JXCategoryListContainerViewDelegate,XPNobleCenterNavViewDelegate, XPIAPHelperDelegate, NIMSystemNotificationManagerDelegate>
|
#import "YuMi-swift.h"
|
||||||
|
@interface XPNobleCenterViewController ()<XPNobleCenterProtocol,XPNobleCenterPayViewDelegate,JXCategoryViewDelegate, JXCategoryListContainerViewDelegate,XPNobleCenterNavViewDelegate, NIMSystemNotificationManagerDelegate>
|
||||||
///分页标题
|
///分页标题
|
||||||
@property (nonatomic, strong) NSArray<NSString *> *titles;
|
@property (nonatomic, strong) NSArray<NSString *> *titles;
|
||||||
///分页控件
|
///分页控件
|
||||||
@@ -92,19 +93,18 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
[XPIAPHelper shareHelper].delegate = nil;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
|
|
||||||
[XPIAPHelper shareHelper].delegate = self;
|
|
||||||
[[NIMSDK sharedSDK].systemNotificationManager addDelegate:self];
|
[[NIMSDK sharedSDK].systemNotificationManager addDelegate:self];
|
||||||
[self requestHttp];
|
[self requestHttp];
|
||||||
[self initSubViews];
|
[self initSubViews];
|
||||||
[self initSubViewConstraints];
|
[self initSubViewConstraints];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)isHiddenNavBar {
|
- (BOOL)isHiddenNavBar {
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
@@ -116,8 +116,8 @@
|
|||||||
[self.presenter getUserInfo];
|
[self.presenter getUserInfo];
|
||||||
}
|
}
|
||||||
if([XPSkillCardPlayerManager shareInstance].isInRoom == YES && [XPSkillCardPlayerManager shareInstance].isInRoomFirstRecharge == NO){
|
if([XPSkillCardPlayerManager shareInstance].isInRoom == YES && [XPSkillCardPlayerManager shareInstance].isInRoomFirstRecharge == NO){
|
||||||
[XPSkillCardPlayerManager shareInstance].isInRoomFirstRecharge = YES;
|
[XPSkillCardPlayerManager shareInstance].isInRoomFirstRecharge = YES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (XPNobleCenterPresenter *)createPresenter {
|
- (XPNobleCenterPresenter *)createPresenter {
|
||||||
@@ -144,7 +144,7 @@
|
|||||||
make.leading.top.trailing.mas_equalTo(self.view);
|
make.leading.top.trailing.mas_equalTo(self.view);
|
||||||
make.height.mas_equalTo(height);
|
make.height.mas_equalTo(height);
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[self.navView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.navView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.leading.trailing.top.mas_equalTo(self.view);
|
make.leading.trailing.top.mas_equalTo(self.view);
|
||||||
make.height.mas_equalTo(kNavigationHeight);
|
make.height.mas_equalTo(kNavigationHeight);
|
||||||
@@ -154,7 +154,7 @@
|
|||||||
make.height.mas_equalTo(40);
|
make.height.mas_equalTo(40);
|
||||||
make.top.mas_equalTo(self.navView.mas_bottom);
|
make.top.mas_equalTo(self.navView.mas_bottom);
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.leading.trailing.bottom.mas_equalTo(self.view);
|
make.leading.trailing.bottom.mas_equalTo(self.view);
|
||||||
make.top.mas_equalTo(self.titleView.mas_bottom);
|
make.top.mas_equalTo(self.titleView.mas_bottom);
|
||||||
@@ -178,7 +178,7 @@
|
|||||||
make.width.height.mas_equalTo(20);
|
make.width.height.mas_equalTo(20);
|
||||||
make.centerY.equalTo(self.openNobleView);
|
make.centerY.equalTo(self.openNobleView);
|
||||||
make.trailing.equalTo(self.openNobleButton.mas_leading).mas_offset(-2);
|
make.trailing.equalTo(self.openNobleButton.mas_leading).mas_offset(-2);
|
||||||
|
|
||||||
}];
|
}];
|
||||||
[self.rankBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.rankBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.width.mas_equalTo(57);
|
make.width.mas_equalTo(57);
|
||||||
@@ -186,7 +186,7 @@
|
|||||||
make.trailing.mas_equalTo(-24);
|
make.trailing.mas_equalTo(-24);
|
||||||
make.top.mas_equalTo(139);
|
make.top.mas_equalTo(139);
|
||||||
}];
|
}];
|
||||||
|
|
||||||
}
|
}
|
||||||
#pragma mark - XPNobleCenterPayViewDelegate
|
#pragma mark - XPNobleCenterPayViewDelegate
|
||||||
- (void)payWithType:(NobleCenterPayType)type{
|
- (void)payWithType:(NobleCenterPayType)type{
|
||||||
@@ -196,11 +196,11 @@
|
|||||||
config.message = YMLocalizedString(@"XPNobleCenterViewController3");
|
config.message = YMLocalizedString(@"XPNobleCenterViewController3");
|
||||||
config.actionStyle = TTAlertActionBothStyle;
|
config.actionStyle = TTAlertActionBothStyle;
|
||||||
[TTPopup alertWithConfig:config showBorder:NO confirmHandler:^{
|
[TTPopup alertWithConfig:config showBorder:NO confirmHandler:^{
|
||||||
|
|
||||||
XPIAPRechargeViewController * webVC =[[XPIAPRechargeViewController alloc] init];
|
XPIAPRechargeViewController * webVC =[[XPIAPRechargeViewController alloc] init];
|
||||||
[self.navigationController pushViewController:webVC animated:YES];
|
[self.navigationController pushViewController:webVC animated:YES];
|
||||||
} cancelHandler:^{
|
} cancelHandler:^{
|
||||||
|
|
||||||
}];
|
}];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -238,8 +238,11 @@
|
|||||||
- (void)checkTranscationIds {
|
- (void)checkTranscationIds {
|
||||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||||
NSArray * array = [RechargeStorage getAllReciptsWithUid:uid];
|
NSArray * array = [RechargeStorage getAllReciptsWithUid:uid];
|
||||||
if (array.count > 0) {
|
for (NSDictionary *transcation in array) {
|
||||||
[self.presenter checkTranscationIds:array];
|
NSString *orderId = transcation[@"orderId"];
|
||||||
|
NSString *transcationId = transcation[@"transcationId"];
|
||||||
|
///二次验证
|
||||||
|
[self.presenter checkReceiptWithOrderId:orderId transcationId:transcationId errorToast:NO];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -285,10 +288,45 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
///请求充值id的状态成功
|
///请求充值id的状态成功
|
||||||
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId {
|
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId uuid:(NSString *)uuid{
|
||||||
if (orderId.length > 0) {
|
if (orderId.length > 0) {
|
||||||
self.orderId = orderId;
|
self.orderId = orderId;
|
||||||
[[XPIAPHelper shareHelper] buyAppProductWithAppProductId:chargeProdId];
|
if (@available(iOS 15.0, *)) {
|
||||||
|
|
||||||
|
PIIAPPayment *iap = [PIIAPPayment shared];
|
||||||
|
[iap requestBuyProductWithProductId:chargeProdId uuid:uuid completionHandler:^(NSError * _Nullable error) {
|
||||||
|
|
||||||
|
}];
|
||||||
|
@kWeakify(self);
|
||||||
|
iap.stateBlock = ^(enum StoreState state, NSDictionary<NSString *,id> * _Nullable result) {
|
||||||
|
@kStrongify(self);
|
||||||
|
|
||||||
|
[self rechargeNewProcessStatus:state];
|
||||||
|
switch (state) {
|
||||||
|
case StoreStateVerifiedServer:
|
||||||
|
{
|
||||||
|
NSString *transactionId = result[@"transactionId"];
|
||||||
|
|
||||||
|
[self rechargeSuccess:transactionId];
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} else {
|
||||||
|
[self hideHUD];
|
||||||
|
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController8")];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
[self hideHUD];
|
[self hideHUD];
|
||||||
}
|
}
|
||||||
@@ -301,6 +339,13 @@
|
|||||||
|
|
||||||
///二次校验成功
|
///二次校验成功
|
||||||
- (void)checkReceiptSuccess:(NSString *)transcationId {
|
- (void)checkReceiptSuccess:(NSString *)transcationId {
|
||||||
|
[self hideHUD];
|
||||||
|
if (@available(iOS 15.0, *)) {
|
||||||
|
PIIAPPayment *iap = [PIIAPPayment shared];
|
||||||
|
[iap transactionFinishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
|
||||||
|
|
||||||
|
}];
|
||||||
|
}
|
||||||
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
|
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
|
||||||
self.orderId = nil;
|
self.orderId = nil;
|
||||||
//5秒之后如果没有收到开通成功的云信消息,则请求一次用户信息
|
//5秒之后如果没有收到开通成功的云信消息,则请求一次用户信息
|
||||||
@@ -311,7 +356,18 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
- (void)checkReceiptFailWithCode:(NSInteger)code transcationId:(NSString *)transcationId{
|
||||||
|
[self hideHUD];
|
||||||
|
if(code == 1444){
|
||||||
|
if (@available(iOS 15.0, *)) {
|
||||||
|
PIIAPPayment *iap = [PIIAPPayment shared];
|
||||||
|
[iap transactionFinishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
|
||||||
|
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
|
||||||
|
}
|
||||||
|
}
|
||||||
///删除本地保存的
|
///删除本地保存的
|
||||||
- (void)deleteRechageReciptWithTransactionIdentifier:(NSString *)transactionIdentifier {
|
- (void)deleteRechageReciptWithTransactionIdentifier:(NSString *)transactionIdentifier {
|
||||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||||
@@ -332,16 +388,15 @@
|
|||||||
}
|
}
|
||||||
#pragma mark - XPIAPHelperDelegate
|
#pragma mark - XPIAPHelperDelegate
|
||||||
///当前充值的状态
|
///当前充值的状态
|
||||||
- (void)rechargeProcessStatus:(PaymentStatus)status {
|
- (void)rechargeNewProcessStatus:(StoreState)status {
|
||||||
[self hideHUD];
|
[self hideHUD];
|
||||||
if (status == PaymentStatus_Purchased) {
|
|
||||||
|
if (status == StoreStatePay || status == StoreStateStart || status == StoreStateVerifiedServer) {
|
||||||
[self showLoading];
|
[self showLoading];
|
||||||
} else if (status == PaymentStatus_Purchasing) {
|
}else if (status == StoreStateUnowned) {
|
||||||
[self showLoading];
|
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController1")];
|
||||||
} else if (status == PaymentStatus_Failed) {
|
}else{
|
||||||
[self showErrorToast:YMLocalizedString(@"XPNobleCenterViewController1")];
|
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController0")];
|
||||||
} else if (status == PaymentStatus_Deferred) {
|
|
||||||
[self showErrorToast:YMLocalizedString(@"XPNobleCenterViewController2")];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -349,10 +404,9 @@
|
|||||||
- (void)rechargeSuccess:(NSString *)transactionIdentifier {
|
- (void)rechargeSuccess:(NSString *)transactionIdentifier {
|
||||||
///保存唯一凭证
|
///保存唯一凭证
|
||||||
[self saveRechageReciptWithTransactionIdentifier:transactionIdentifier];
|
[self saveRechageReciptWithTransactionIdentifier:transactionIdentifier];
|
||||||
NSData *receiptData = [NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]];
|
[self showLoading];
|
||||||
NSString * receipt = [MF_Base64Codec base64StringFromData:receiptData];
|
|
||||||
///二次验证
|
///二次验证
|
||||||
[self.presenter checkReceiptWithData:receipt orderId:self.orderId transcationId:transactionIdentifier];
|
[self.presenter checkReceiptWithOrderId:self.orderId transcationId:transactionIdentifier errorToast:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
///充值成功之后保存订单到钥匙串
|
///充值成功之后保存订单到钥匙串
|
||||||
@@ -442,7 +496,7 @@
|
|||||||
payView.delegate = self;
|
payView.delegate = self;
|
||||||
[self.view addSubview:payView];
|
[self.view addSubview:payView];
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Getters And Setters
|
#pragma mark - Getters And Setters
|
||||||
@@ -519,7 +573,7 @@
|
|||||||
_openNobleButton.textColor = [DJDKMIMOMColor mainTextColor];
|
_openNobleButton.textColor = [DJDKMIMOMColor mainTextColor];
|
||||||
_openNobleButton.numberOfLines = 0;
|
_openNobleButton.numberOfLines = 0;
|
||||||
_openNobleButton.textAlignment = NSTextAlignmentCenter;
|
_openNobleButton.textAlignment = NSTextAlignmentCenter;
|
||||||
|
|
||||||
}
|
}
|
||||||
return _openNobleButton;
|
return _openNobleButton;
|
||||||
}
|
}
|
||||||
|
@@ -30,10 +30,10 @@
|
|||||||
#import "XPMineRechargeProtocol.h"
|
#import "XPMineRechargeProtocol.h"
|
||||||
///VC
|
///VC
|
||||||
#import "XPWebViewController.h"
|
#import "XPWebViewController.h"
|
||||||
|
#import "YuMi-swift.h"
|
||||||
#define kHeaderViewHeight 220.0/375.0*KScreenWidth
|
#define kHeaderViewHeight 220.0/375.0*KScreenWidth
|
||||||
|
|
||||||
@interface XPIAPRechargeViewController ()<UICollectionViewDelegate, UICollectionViewDataSource, XPMineRechargeProtocol, XPIAPHelperDelegate, XPMineRechargeNavViewDelegate>
|
@interface XPIAPRechargeViewController ()<UICollectionViewDelegate, UICollectionViewDataSource, XPMineRechargeProtocol, XPMineRechargeNavViewDelegate>
|
||||||
|
|
||||||
@property (nonatomic, strong) UICollectionView *collectionView;
|
@property (nonatomic, strong) UICollectionView *collectionView;
|
||||||
/// 头部
|
/// 头部
|
||||||
@@ -86,7 +86,6 @@
|
|||||||
[self createUI];
|
[self createUI];
|
||||||
[self initHttpData];
|
[self initHttpData];
|
||||||
|
|
||||||
[XPIAPHelper shareHelper].delegate = self;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)createUI {
|
- (void)createUI {
|
||||||
@@ -202,9 +201,32 @@
|
|||||||
- (void)checkTranscationIds {
|
- (void)checkTranscationIds {
|
||||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||||
NSArray * array = [RechargeStorage getAllReciptsWithUid:uid];
|
NSArray * array = [RechargeStorage getAllReciptsWithUid:uid];
|
||||||
if (array.count > 0) {
|
|
||||||
[self.presenter checkTranscationIds:array];
|
// [self.presenter checkReceiptWithOrderId:self.orderId transcationId:transactionIdentifier];
|
||||||
|
// NSMutableArray *list = [NSMutableArray array];
|
||||||
|
// for (NSDictionary *transcationDic in array) {
|
||||||
|
// NSString *transcationId = transcationDic[@"transcationId"];
|
||||||
|
// if(transcationId){
|
||||||
|
// [list addObject:transcationId];
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if(list.count > 0){
|
||||||
|
// if (@available(iOS 15.0, *)) {
|
||||||
|
// PIIAPPayment *iap = [PIIAPPayment shared];
|
||||||
|
// [iap allTransactionWithList:list completionHandler:^{
|
||||||
|
//
|
||||||
|
// }];
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
for (NSDictionary *transcation in array) {
|
||||||
|
NSString *orderId = transcation[@"orderId"];
|
||||||
|
NSString *transcationId = transcation[@"transcationId"];
|
||||||
|
///二次验证
|
||||||
|
[self.presenter checkReceiptWithOrderId:orderId transcationId:transcationId errorToast:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///充值成功之后保存订单到钥匙串
|
///充值成功之后保存订单到钥匙串
|
||||||
@@ -239,16 +261,15 @@
|
|||||||
|
|
||||||
#pragma mark - XPIAPHelperDelegate
|
#pragma mark - XPIAPHelperDelegate
|
||||||
///当前充值的状态
|
///当前充值的状态
|
||||||
- (void)rechargeProcessStatus:(PaymentStatus)status {
|
- (void)rechargeNewProcessStatus:(StoreState)status {
|
||||||
[self hideHUD];
|
[self hideHUD];
|
||||||
if (status == PaymentStatus_Purchased) {
|
|
||||||
|
if (status == StoreStatePay || status == StoreStateStart || status == StoreStateVerifiedServer) {
|
||||||
[self showLoading];
|
[self showLoading];
|
||||||
} else if (status == PaymentStatus_Purchasing) {
|
}else if (status == StoreStateUnowned) {
|
||||||
[self showLoading];
|
|
||||||
} else if (status == PaymentStatus_Failed) {
|
|
||||||
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController0")];
|
|
||||||
} else if (status == PaymentStatus_Deferred) {
|
|
||||||
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController1")];
|
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController1")];
|
||||||
|
}else{
|
||||||
|
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController0")];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,10 +277,10 @@
|
|||||||
- (void)rechargeSuccess:(NSString *)transactionIdentifier {
|
- (void)rechargeSuccess:(NSString *)transactionIdentifier {
|
||||||
///保存唯一凭证
|
///保存唯一凭证
|
||||||
[self saveRechageReciptWithTransactionIdentifier:transactionIdentifier];
|
[self saveRechageReciptWithTransactionIdentifier:transactionIdentifier];
|
||||||
NSData *receiptData = [NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]];
|
[self showLoading];
|
||||||
NSString * receipt = [MF_Base64Codec base64StringFromData:receiptData];
|
|
||||||
///二次验证
|
///二次验证
|
||||||
[self.presenter checkReceiptWithData:receipt orderId:self.orderId transcationId:transactionIdentifier];
|
[self.presenter checkReceiptWithOrderId:self.orderId transcationId:transactionIdentifier errorToast:YES];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - XPMineRechargeProtocol
|
#pragma mark - XPMineRechargeProtocol
|
||||||
@@ -268,10 +289,51 @@
|
|||||||
[self.collectionView reloadData];
|
[self.collectionView reloadData];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId {
|
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId uuid:(nonnull NSString *)uuid{
|
||||||
|
|
||||||
if (orderId.length > 0) {
|
if (orderId.length > 0) {
|
||||||
|
|
||||||
self.orderId = orderId;
|
self.orderId = orderId;
|
||||||
[[XPIAPHelper shareHelper] buyAppProductWithAppProductId:chargeProdId];
|
if (@available(iOS 15.0, *)) {
|
||||||
|
|
||||||
|
PIIAPPayment *iap = [PIIAPPayment shared];
|
||||||
|
[iap requestBuyProductWithProductId:chargeProdId uuid:uuid completionHandler:^(NSError * _Nullable error) {
|
||||||
|
|
||||||
|
}];
|
||||||
|
@kWeakify(self);
|
||||||
|
iap.stateBlock = ^(enum StoreState state, NSDictionary<NSString *,id> * _Nullable result) {
|
||||||
|
@kStrongify(self);
|
||||||
|
|
||||||
|
[self rechargeNewProcessStatus:state];
|
||||||
|
switch (state) {
|
||||||
|
case StoreStateVerifiedServer:
|
||||||
|
{
|
||||||
|
NSString *transactionId = result[@"transactionId"];
|
||||||
|
|
||||||
|
[self rechargeSuccess:transactionId];
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} else {
|
||||||
|
[self hideHUD];
|
||||||
|
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController8")];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}else{
|
||||||
|
[self hideHUD];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,7 +344,15 @@
|
|||||||
|
|
||||||
///二次验证成功
|
///二次验证成功
|
||||||
- (void)checkReceiptSuccess:(NSString *)transcationId {
|
- (void)checkReceiptSuccess:(NSString *)transcationId {
|
||||||
|
[self hideHUD];
|
||||||
|
if (@available(iOS 15.0, *)) {
|
||||||
|
PIIAPPayment *iap = [PIIAPPayment shared];
|
||||||
|
[iap transactionFinishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
|
||||||
|
|
||||||
|
}];
|
||||||
|
}
|
||||||
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
|
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
|
||||||
|
|
||||||
///刷新一下用户的💎
|
///刷新一下用户的💎
|
||||||
[self getUserWalletBalanceInfo];
|
[self getUserWalletBalanceInfo];
|
||||||
self.orderId = nil;
|
self.orderId = nil;
|
||||||
@@ -291,7 +361,18 @@
|
|||||||
[self.delegate paySuccess];
|
[self.delegate paySuccess];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
-(void)checkReceiptFailWithCode:(NSInteger)code transcationId:(NSString *)transcationId{
|
||||||
|
[self hideHUD];
|
||||||
|
if(code == 1444){
|
||||||
|
if (@available(iOS 15.0, *)) {
|
||||||
|
PIIAPPayment *iap = [PIIAPPayment shared];
|
||||||
|
[iap transactionFinishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
|
||||||
|
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
|
||||||
|
}
|
||||||
|
}
|
||||||
- (void)getUserWalletInfo:(WalletInfoModel *)balanceInfo {
|
- (void)getUserWalletInfo:(WalletInfoModel *)balanceInfo {
|
||||||
self.headerView.walletInfo = balanceInfo;
|
self.headerView.walletInfo = balanceInfo;
|
||||||
}
|
}
|
||||||
|
@@ -208,7 +208,7 @@
|
|||||||
NSData *receiptData = [NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]];
|
NSData *receiptData = [NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]];
|
||||||
NSString * receipt = [MF_Base64Codec base64StringFromData:receiptData];
|
NSString * receipt = [MF_Base64Codec base64StringFromData:receiptData];
|
||||||
///二次验证
|
///二次验证
|
||||||
[self.presenter checkReceiptWithData:receipt orderId:self.orderId transcationId:transactionIdentifier];
|
// [self.presenter checkReceiptWithData:receipt orderId:self.orderId transcationId:transactionIdentifier];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - XPMineRechargeProtocol
|
#pragma mark - XPMineRechargeProtocol
|
||||||
|
@@ -58,6 +58,7 @@
|
|||||||
#import "XPIAPRechargeViewController.h"
|
#import "XPIAPRechargeViewController.h"
|
||||||
#import "XPIncomeRecordVC.h"
|
#import "XPIncomeRecordVC.h"
|
||||||
#import "XPNobleCenterViewController.h"
|
#import "XPNobleCenterViewController.h"
|
||||||
|
#import "YuMi-swift.h"
|
||||||
UIKIT_EXTERN NSString *kRequestRicket;
|
UIKIT_EXTERN NSString *kRequestRicket;
|
||||||
|
|
||||||
@interface XPMineViewController ()<UITableViewDelegate, UITableViewDataSource, XPMineProtocol, XPMineHeadItemTableViewCellDelegate, XPMineHeadViewDelegate, XPHomeBannerTableViewCellDelegate>
|
@interface XPMineViewController ()<UITableViewDelegate, UITableViewDataSource, XPMineProtocol, XPMineHeadItemTableViewCellDelegate, XPMineHeadViewDelegate, XPHomeBannerTableViewCellDelegate>
|
||||||
@@ -294,11 +295,96 @@ UIKIT_EXTERN NSString *kRequestRicket;
|
|||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case XPMineItemType_My_Refund:{
|
||||||
|
#ifdef DEBUG
|
||||||
|
|
||||||
|
|
||||||
|
UIView *bgView = [[UIView alloc]init];
|
||||||
|
[kWindow addSubview:bgView];
|
||||||
|
[bgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.top.left.bottom.right.mas_equalTo(0);
|
||||||
|
|
||||||
|
}];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(hiddenTextVeiw:)];
|
||||||
|
[bgView addGestureRecognizer:tap];
|
||||||
|
bgView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.6];
|
||||||
|
|
||||||
|
UIView *bgView1 = [UIView new];
|
||||||
|
bgView1.layer.cornerRadius = 10;
|
||||||
|
bgView1.layer.masksToBounds = YES;
|
||||||
|
[bgView addSubview:bgView1];
|
||||||
|
bgView1.backgroundColor = [UIColor whiteColor];
|
||||||
|
CGFloat width = KScreenWidth - kGetScaleWidth(60);
|
||||||
|
[bgView1 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.center.equalTo(bgView);
|
||||||
|
make.width.mas_equalTo(width);
|
||||||
|
make.height.mas_equalTo(kGetScaleWidth(200));
|
||||||
|
}];
|
||||||
|
|
||||||
|
|
||||||
|
UITextField *textf = [[UITextField alloc]init];
|
||||||
|
textf.backgroundColor = UIColorRGBAlpha(0xBBBCCF, 0.1);
|
||||||
|
textf.layer.cornerRadius = kGetScaleWidth(40)/2;
|
||||||
|
textf.layer.masksToBounds = YES;
|
||||||
|
textf.attributedPlaceholder = [[NSMutableAttributedString alloc]initWithString:@" 请输入订单号" attributes:@{NSForegroundColorAttributeName:UIColorFromRGB(0x2B2D33),NSFontAttributeName:kFontRegular(14)}];
|
||||||
|
textf.textColor = UIColorFromRGB(0x222222);
|
||||||
|
|
||||||
|
textf.font = kFontRegular(14);
|
||||||
|
[bgView1 addSubview:textf];
|
||||||
|
[textf mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.centerX.equalTo(bgView1);
|
||||||
|
make.top.mas_equalTo(kGetScaleWidth(25));
|
||||||
|
make.left.right.equalTo(bgView1).inset(kGetScaleWidth(30));
|
||||||
|
make.height.mas_equalTo(kGetScaleWidth(40));
|
||||||
|
}];
|
||||||
|
textf.tag = 1001;
|
||||||
|
|
||||||
|
UIButton *bnt = [UIButton new];
|
||||||
|
[bnt setBackgroundImage:[UIImage gradientColorImageFromColors:@[[DJDKMIMOMColor confirmButtonGradientStartColor], [DJDKMIMOMColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(kGetScaleWidth(200), kGetScaleWidth(50))] forState:UIControlStateNormal];
|
||||||
|
[bnt setTitle:@"确定" forState:UIControlStateNormal];
|
||||||
|
[bnt setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||||
|
[bnt addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventTouchUpInside];
|
||||||
|
[bgView1 addSubview:bnt];
|
||||||
|
[bnt mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.centerX.equalTo(bgView1);
|
||||||
|
make.top.equalTo(textf.mas_bottom).mas_offset(kGetScaleWidth(40));
|
||||||
|
make.width.mas_equalTo(kGetScaleWidth(250));
|
||||||
|
make.height.mas_equalTo(kGetScaleWidth(50));
|
||||||
|
}];
|
||||||
|
bnt.layer.cornerRadius = kGetScaleWidth(50)/2;
|
||||||
|
bnt.layer.masksToBounds = YES;
|
||||||
|
#else
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
-(void)hiddenTextVeiw:(UITapGestureRecognizer *)sender{
|
||||||
|
[sender.view removeFromSuperview];
|
||||||
|
|
||||||
|
}
|
||||||
|
- (void)textFieldDidChange:(UIButton *)sender {
|
||||||
|
|
||||||
|
UITextField *textField = [sender.superview viewWithTag:1001];
|
||||||
|
[textField.superview.superview removeFromSuperview];
|
||||||
|
if (textField.text.length == 0) {
|
||||||
|
[self showErrorToast:@"请输入订单号"];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (@available(iOS 15.0, *)) {
|
||||||
|
PIIAPPayment *iap = [PIIAPPayment shared];
|
||||||
|
NSUInteger text = [textField.text integerValue];
|
||||||
|
[iap refunRequestWithView:self.view transactionId:text completionHandler:^{
|
||||||
|
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
- (void)pushWebViewWIthUrl:(NSString *)url {
|
- (void)pushWebViewWIthUrl:(NSString *)url {
|
||||||
XPWebViewController * webVC = [[XPWebViewController alloc] init];
|
XPWebViewController * webVC = [[XPWebViewController alloc] init];
|
||||||
|
@@ -136,8 +136,8 @@
|
|||||||
/// @param roomUid 房间uid
|
/// @param roomUid 房间uid
|
||||||
/// @param ticket ticket
|
/// @param ticket ticket
|
||||||
+ (void)requestReportUserInterRoom:(HttpRequestHelperCompletion)completion uid:(NSString *)uid roomUid:(NSString *)roomUid ticket:(NSString *)ticket {
|
+ (void)requestReportUserInterRoom:(HttpRequestHelperCompletion)completion uid:(NSString *)uid roomUid:(NSString *)roomUid ticket:(NSString *)ticket {
|
||||||
NSString * fang = [NSString stringFromBase64String:@""];///userroom/inV2
|
|
||||||
[self makeRequest:fang method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, uid, roomUid, ticket, nil];
|
[self makeRequest:@"userroom/inV2" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, uid, roomUid, ticket, nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 上报用户退房
|
/// 上报用户退房
|
||||||
@@ -197,8 +197,8 @@
|
|||||||
/// 获取个播PK规则
|
/// 获取个播PK规则
|
||||||
/// @param completion 完成
|
/// @param completion 完成
|
||||||
+ (void)requestAnchorPkRule:(HttpRequestHelperCompletion)completion {
|
+ (void)requestAnchorPkRule:(HttpRequestHelperCompletion)completion {
|
||||||
NSString * fang = [NSString stringFromBase64String:@""];///
|
|
||||||
[self makeRequest:fang method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, nil];
|
[self makeRequest:@"crossroompkround/getSingleRoomPkRule" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - 超管
|
#pragma mark - 超管
|
||||||
|
@@ -188,7 +188,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
[Api requestReportUserInterRoom:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
[Api requestReportUserInterRoom:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||||
|
NSLog(@"%ld",code);
|
||||||
} uid:[[AccountInfoStorage instance] getUid] roomUid:roomUid ticket:[[AccountInfoStorage instance] getTicket]];
|
} uid:[[AccountInfoStorage instance] getUid] roomUid:roomUid ticket:[[AccountInfoStorage instance] getTicket]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -12,6 +12,8 @@
|
|||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@interface XPRoomAnimationView : XPRoomAnimationHitView <RoomGuestDelegate>
|
@interface XPRoomAnimationView : XPRoomAnimationHitView <RoomGuestDelegate>
|
||||||
|
|
||||||
|
-(void)resumeTimer;
|
||||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate;
|
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@@ -153,6 +153,9 @@
|
|||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
[NSObject cancelPreviousPerformRequestsWithTarget:self];
|
[NSObject cancelPreviousPerformRequestsWithTarget:self];
|
||||||
[[NIMSDK sharedSDK].broadcastManager removeDelegate:self];
|
[[NIMSDK sharedSDK].broadcastManager removeDelegate:self];
|
||||||
|
|
||||||
|
}
|
||||||
|
-(void)resumeTimer{
|
||||||
if(self.giftEffectTimer != nil){
|
if(self.giftEffectTimer != nil){
|
||||||
dispatch_resume(self.giftEffectTimer);
|
dispatch_resume(self.giftEffectTimer);
|
||||||
self.giftEffectTimer = nil;
|
self.giftEffectTimer = nil;
|
||||||
@@ -163,7 +166,6 @@
|
|||||||
self.giftTimer = nil;
|
self.giftTimer = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
|
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
#import "AccountInfoStorage.h"
|
#import "AccountInfoStorage.h"
|
||||||
#import "YYUtility.h"
|
#import "YYUtility.h"
|
||||||
#import "Api+Mine.h"
|
#import "Api+Mine.h"
|
||||||
#import "XPIAPHelper.h"
|
|
||||||
#import "RechargeStorage.h"
|
#import "RechargeStorage.h"
|
||||||
///Model
|
///Model
|
||||||
#import "FirstRechargeModel.h"
|
#import "FirstRechargeModel.h"
|
||||||
@@ -34,7 +34,8 @@
|
|||||||
#import "Api+FirstRecharge.h"
|
#import "Api+FirstRecharge.h"
|
||||||
#import "FirstRechargeModel.h"
|
#import "FirstRechargeModel.h"
|
||||||
#import "XPSkillCardPlayerManager.h"
|
#import "XPSkillCardPlayerManager.h"
|
||||||
@interface XPFirstRechargeView ()<UICollectionViewDelegate, UICollectionViewDataSource,UICollectionViewDelegateFlowLayout, XPIAPHelperDelegate>
|
#import "YuMi-swift.h"
|
||||||
|
@interface XPFirstRechargeView ()<UICollectionViewDelegate, UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
|
||||||
///
|
///
|
||||||
@property (nonatomic,strong) UIButton *backBtn;
|
@property (nonatomic,strong) UIButton *backBtn;
|
||||||
///背景图
|
///背景图
|
||||||
@@ -71,7 +72,7 @@
|
|||||||
@implementation XPFirstRechargeView
|
@implementation XPFirstRechargeView
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
[XPIAPHelper shareHelper].delegate = nil;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -81,8 +82,8 @@
|
|||||||
[self initSubViews];
|
[self initSubViews];
|
||||||
[self initSubViewConstraints];
|
[self initSubViewConstraints];
|
||||||
[self getFirstRechargeRewardList];
|
[self getFirstRechargeRewardList];
|
||||||
[XPIAPHelper shareHelper].delegate = self;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -98,6 +99,7 @@
|
|||||||
}
|
}
|
||||||
[XNDJTDDLoadingTool showErrorWithMessage:msg];
|
[XNDJTDDLoadingTool showErrorWithMessage:msg];
|
||||||
} channelType:@"3"];
|
} channelType:@"3"];
|
||||||
|
[self checkTranscationIds];
|
||||||
}
|
}
|
||||||
#pragma mark - Private Method
|
#pragma mark - Private Method
|
||||||
- (void)initSubViews {
|
- (void)initSubViews {
|
||||||
@@ -199,7 +201,7 @@
|
|||||||
if (array.count <= 0) return;
|
if (array.count <= 0) return;
|
||||||
self.typeArrowView.hidden = NO;
|
self.typeArrowView.hidden = NO;
|
||||||
self.originArray = array;
|
self.originArray = array;
|
||||||
self.currentInfo = [array safeObjectAtIndex1:0];
|
self.currentInfo = [array safeObjectAtIndex1:0];
|
||||||
if (self.segmentView.arrangedSubviews.count > 0) {
|
if (self.segmentView.arrangedSubviews.count > 0) {
|
||||||
[[self.segmentView arrangedSubviews] enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
[[self.segmentView arrangedSubviews] enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||||
[obj removeFromSuperview];
|
[obj removeFromSuperview];
|
||||||
@@ -207,7 +209,7 @@
|
|||||||
}
|
}
|
||||||
for (int i = 0 ; i < array.count; i++) {
|
for (int i = 0 ; i < array.count; i++) {
|
||||||
FirstRechargeModel * modelInfo = [array safeObjectAtIndex1:i];
|
FirstRechargeModel * modelInfo = [array safeObjectAtIndex1:i];
|
||||||
NSString * title = [NSString stringWithFormat:@"$%.2f", modelInfo.chargeMoney];
|
NSString * title = [NSString stringWithFormat:@"$%.2f", modelInfo.chargeMoney];
|
||||||
UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
|
UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected];
|
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected];
|
||||||
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||||
@@ -263,94 +265,183 @@
|
|||||||
/// 获取充值的订单编号
|
/// 获取充值的订单编号
|
||||||
/// @param chargeProdId 苹果服务器的充值 的id
|
/// @param chargeProdId 苹果服务器的充值 的id
|
||||||
- (void)requestIAPRechargeOrderWithChargeProdId:(NSString *)chargeProdId {
|
- (void)requestIAPRechargeOrderWithChargeProdId:(NSString *)chargeProdId {
|
||||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||||
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
||||||
NSString * deviceInfo = [YYUtility deviceID];
|
NSString * deviceInfo = [YYUtility deviceID];
|
||||||
NSString * clientIp= [YYUtility ipAddress];
|
NSString * clientIp= [YYUtility ipAddress];
|
||||||
[Api requestIAPRecharge:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
[Api requestIAPRecharge:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
NSString *orderId = (NSString *)data.data[@"recordId"];
|
NSString *orderId = (NSString *)data.data[@"recordId"];
|
||||||
[self requestIAPRechargeOrderSuccess:orderId chargeProdId:chargeProdId];
|
NSString *uuid = (NSString *)data.data[@"appAccountToken"];
|
||||||
} else {
|
[self requestIAPRechargeOrderSuccess:orderId chargeProdId:chargeProdId uuid:uuid];
|
||||||
[XNDJTDDLoadingTool hideHUD];
|
} else {
|
||||||
[XNDJTDDLoadingTool showErrorWithMessage:msg];
|
[XNDJTDDLoadingTool hideHUD];
|
||||||
}
|
[XNDJTDDLoadingTool showErrorWithMessage:msg];
|
||||||
} chargeProdId:chargeProdId uid:uid ticket:ticket deviceInfo:deviceInfo clientIp:clientIp];
|
}
|
||||||
|
} chargeProdId:chargeProdId uid:uid ticket:ticket deviceInfo:deviceInfo clientIp:clientIp];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId {
|
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId uuid:(NSString *)uuid{
|
||||||
if (orderId.length > 0) {
|
if (orderId.length > 0) {
|
||||||
self.orderId = orderId;
|
self.orderId = orderId;
|
||||||
[[XPIAPHelper shareHelper] buyAppProductWithAppProductId:chargeProdId];
|
|
||||||
}
|
if (@available(iOS 15.0, *)) {
|
||||||
|
|
||||||
|
PIIAPPayment *iap = [PIIAPPayment shared];
|
||||||
|
[iap requestBuyProductWithProductId:chargeProdId uuid:uuid completionHandler:^(NSError * _Nullable error) {
|
||||||
|
|
||||||
|
}];
|
||||||
|
@kWeakify(self);
|
||||||
|
iap.stateBlock = ^(enum StoreState state, NSDictionary<NSString *,id> * _Nullable result) {
|
||||||
|
@kStrongify(self);
|
||||||
|
|
||||||
|
[self rechargeNewProcessStatus:state];
|
||||||
|
switch (state) {
|
||||||
|
case StoreStateVerifiedServer:
|
||||||
|
{
|
||||||
|
NSString *transactionId = result[@"transactionId"];
|
||||||
|
|
||||||
|
[self rechargeSuccess:transactionId];
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} else {
|
||||||
|
[XNDJTDDLoadingTool hideHUD];
|
||||||
|
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPIAPRechargeViewController8")];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}else{
|
||||||
|
[XNDJTDDLoadingTool hideHUD];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#pragma mark - XPIAPHelperDelegate
|
#pragma mark - XPIAPHelperDelegate
|
||||||
|
|
||||||
///当前充值的状态
|
///当前充值的状态
|
||||||
- (void)rechargeProcessStatus:(PaymentStatus)status {
|
- (void)rechargeNewProcessStatus:(StoreState)status {
|
||||||
[XNDJTDDLoadingTool hideHUD];
|
[XNDJTDDLoadingTool hideHUD];
|
||||||
if (status == PaymentStatus_Purchased) {
|
|
||||||
[XNDJTDDLoadingTool showLoading];
|
if (status == StoreStatePay || status == StoreStateStart || status == StoreStateVerifiedServer) {
|
||||||
} else if (status == PaymentStatus_Purchasing) {
|
[XNDJTDDLoadingTool showLoading];
|
||||||
[XNDJTDDLoadingTool showLoading];
|
}else if (status == StoreStateUnowned) {
|
||||||
} else if (status == PaymentStatus_Failed) {
|
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPIAPRechargeViewController1")];
|
||||||
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPIAPRechargeViewController0")];
|
}else{
|
||||||
} else if (status == PaymentStatus_Deferred) {
|
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPIAPRechargeViewController0")];
|
||||||
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPIAPRechargeViewController1")];
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///充值成功回调id
|
///充值成功回调id
|
||||||
- (void)rechargeSuccess:(NSString *)transactionIdentifier {
|
- (void)rechargeSuccess:(NSString *)transactionIdentifier {
|
||||||
///保存唯一凭证
|
///保存唯一凭证
|
||||||
[self saveRechageReciptWithTransactionIdentifier:transactionIdentifier];
|
[self saveRechageReciptWithTransactionIdentifier:transactionIdentifier];
|
||||||
NSData *receiptData = [NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]];
|
///二次验证
|
||||||
NSString * receipt = [MF_Base64Codec base64StringFromData:receiptData];
|
[self checkReceiptWithOrderId:self.orderId transcationId:transactionIdentifier errorToast:YES];
|
||||||
///二次验证
|
|
||||||
[self checkReceiptWithData:receipt orderId:self.orderId transcationId:transactionIdentifier];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///充值成功之后保存订单到钥匙串
|
///充值成功之后保存订单到钥匙串
|
||||||
- (void)saveRechageReciptWithTransactionIdentifier:(NSString *)transactionIdentifier {
|
- (void)saveRechageReciptWithTransactionIdentifier:(NSString *)transactionIdentifier {
|
||||||
NSData *receipt = [NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]];
|
NSData *receipt = [NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]];
|
||||||
NSString *encodeStr = [receipt base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithLineFeed];
|
NSString *encodeStr = [receipt base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithLineFeed];
|
||||||
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
|
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
|
||||||
[dictionary setObject:transactionIdentifier forKey:@"transcationId"];
|
[dictionary setObject:transactionIdentifier forKey:@"transcationId"];
|
||||||
[dictionary setObject:encodeStr forKey:@"recipt"];
|
[dictionary setObject:encodeStr forKey:@"recipt"];
|
||||||
[dictionary setObject:self.orderId forKey:@"orderId"];
|
[dictionary setObject:self.orderId forKey:@"orderId"];
|
||||||
NSString *reciptJson = [dictionary toJSONString];
|
NSString *reciptJson = [dictionary toJSONString];
|
||||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||||
BOOL saveSuccess = [RechargeStorage saveTranscationId:transactionIdentifier recipt:reciptJson uid:uid];
|
BOOL saveSuccess = [RechargeStorage saveTranscationId:transactionIdentifier recipt:reciptJson uid:uid];
|
||||||
if (!saveSuccess) {
|
if (!saveSuccess) {
|
||||||
#warning to do 保存失败 需要埋点
|
#warning to do 保存失败 需要埋点
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///删除本地保存的
|
///删除本地保存的
|
||||||
- (void)deleteRechageReciptWithTransactionIdentifier:(NSString *)transactionIdentifier {
|
- (void)deleteRechageReciptWithTransactionIdentifier:(NSString *)transactionIdentifier {
|
||||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||||
BOOL deleteSuccess = [RechargeStorage delegateTranscationId:transactionIdentifier uid:uid];
|
BOOL deleteSuccess = [RechargeStorage delegateTranscationId:transactionIdentifier uid:uid];
|
||||||
if (deleteSuccess) {
|
if (deleteSuccess) {
|
||||||
#warning to do 保存失败 需要埋点
|
#warning to do 保存失败 需要埋点
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
///批量验证
|
||||||
- (void)checkReceiptWithData:(NSString *)receipt orderId:(NSString *)orderId transcationId:(NSString *)transcationId {
|
- (void)checkTranscationIds {
|
||||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||||
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
NSArray * array = [RechargeStorage getAllReciptsWithUid:uid];
|
||||||
[Api checkReceipt:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
|
||||||
if (code == 200) {
|
// [self.presenter checkReceiptWithOrderId:self.orderId transcationId:transactionIdentifier];
|
||||||
[self checkReceiptSuccess:transcationId];
|
// NSMutableArray *list = [NSMutableArray array];
|
||||||
} else {
|
// for (NSDictionary *transcationDic in array) {
|
||||||
[XNDJTDDLoadingTool showErrorWithMessage:msg];
|
// NSString *transcationId = transcationDic[@"transcationId"];
|
||||||
}
|
// if(transcationId){
|
||||||
|
// [list addObject:transcationId];
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if(list.count > 0){
|
||||||
|
// if (@available(iOS 15.0, *)) {
|
||||||
|
// PIIAPPayment *iap = [PIIAPPayment shared];
|
||||||
|
// [iap allTransactionWithList:list completionHandler:^{
|
||||||
|
//
|
||||||
|
// }];
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
for (NSDictionary *transcation in array) {
|
||||||
|
NSString *orderId = transcation[@"orderId"];
|
||||||
|
NSString *transcationId = transcation[@"transcationId"];
|
||||||
|
///二次验证
|
||||||
|
[self checkReceiptWithOrderId:orderId transcationId:transcationId errorToast:NO] ;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
- (void)checkReceiptWithOrderId:(NSString *)orderId transcationId:(NSString *)transcationId errorToast:(BOOL)errorToast{
|
||||||
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||||
|
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
||||||
|
|
||||||
|
[Api checkReceipt:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||||
|
|
||||||
|
if (code == 200) {
|
||||||
|
[self checkReceiptSuccess:transcationId];
|
||||||
|
} else {
|
||||||
|
if(code == 1444){
|
||||||
|
if (@available(iOS 15.0, *)) {
|
||||||
|
PIIAPPayment *iap = [PIIAPPayment shared];
|
||||||
|
[iap transactionFinishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
|
||||||
|
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
|
||||||
|
}
|
||||||
|
if(errorToast == YES){
|
||||||
|
[XNDJTDDLoadingTool showErrorWithMessage:msg];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
[XNDJTDDLoadingTool hideHUD];
|
[XNDJTDDLoadingTool hideHUD];
|
||||||
} receipt:receipt chooseEnv:@"true" chargeRecordId:orderId transcationId:transcationId uid:uid ticket:ticket];
|
} chooseEnv:@"true" chargeRecordId:orderId transcationId:transcationId uid:uid ticket:ticket];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///二次验证成功
|
///二次验证成功
|
||||||
- (void)checkReceiptSuccess:(NSString *)transcationId {
|
- (void)checkReceiptSuccess:(NSString *)transcationId {
|
||||||
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
|
if (@available(iOS 15.0, *)) {
|
||||||
self.orderId = nil;
|
PIIAPPayment *iap = [PIIAPPayment shared];
|
||||||
|
[iap transactionFinishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
|
||||||
|
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
|
||||||
|
self.orderId = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Event Response
|
#pragma mark - Event Response
|
||||||
@@ -362,14 +453,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)rechargeButtonAction {
|
- (void)rechargeButtonAction {
|
||||||
if (self.currentInfo == nil|| self.currentInfo.chargeProdId == nil) {
|
if (self.currentInfo == nil|| self.currentInfo.chargeProdId == nil) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FirstRechargeModel *model = self.currentInfo;
|
FirstRechargeModel *model = self.currentInfo;
|
||||||
if (model.chargeProdId) {
|
if (model.chargeProdId) {
|
||||||
[XNDJTDDLoadingTool showLoading];
|
[XNDJTDDLoadingTool showLoading];
|
||||||
[self requestIAPRechargeOrderWithChargeProdId:model.chargeProdId];
|
[self requestIAPRechargeOrderWithChargeProdId:model.chargeProdId];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
-(void)backAction{
|
-(void)backAction{
|
||||||
[self removeFromSuperview];
|
[self removeFromSuperview];
|
||||||
@@ -377,7 +468,7 @@
|
|||||||
- (void)buttonAction:(UIButton *)sender {
|
- (void)buttonAction:(UIButton *)sender {
|
||||||
if (sender.tag <= self.originArray.count) {
|
if (sender.tag <= self.originArray.count) {
|
||||||
FirstRechargeModel * model = [self.originArray safeObjectAtIndex1:sender.tag];
|
FirstRechargeModel * model = [self.originArray safeObjectAtIndex1:sender.tag];
|
||||||
self.currentInfo = model;
|
self.currentInfo = model;
|
||||||
[self createExtraRewardAttrebute:model];
|
[self createExtraRewardAttrebute:model];
|
||||||
self.rewardArray = model.firstChargeRewardList;
|
self.rewardArray = model.firstChargeRewardList;
|
||||||
self.collectionView.hidden = self.rewardArray.count < 2;
|
self.collectionView.hidden = self.rewardArray.count < 2;
|
||||||
@@ -541,7 +632,7 @@
|
|||||||
if (!_backBtn){
|
if (!_backBtn){
|
||||||
_backBtn = [UIButton new];
|
_backBtn = [UIButton new];
|
||||||
[_backBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
|
[_backBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
|
||||||
|
|
||||||
}
|
}
|
||||||
return _backBtn;
|
return _backBtn;
|
||||||
}
|
}
|
||||||
|
@@ -647,7 +647,11 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
|
|||||||
} else {
|
} else {
|
||||||
[self.presenter getUserWallInfo];
|
[self.presenter getUserWallInfo];
|
||||||
}
|
}
|
||||||
[self sendCustomMessage:receiveInfo oringinDic:originDic];
|
dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC));
|
||||||
|
dispatch_after(delayTime, dispatch_get_main_queue(), ^{
|
||||||
|
[self sendCustomMessage:receiveInfo oringinDic:originDic];
|
||||||
|
});
|
||||||
|
|
||||||
///发送涂鸦礼物消息
|
///发送涂鸦礼物消息
|
||||||
[self sendGraffitiGiftMessage];
|
[self sendGraffitiGiftMessage];
|
||||||
if (self.segmentType == GiftSegmentType_Graffiti) {
|
if (self.segmentType == GiftSegmentType_Graffiti) {
|
||||||
|
@@ -1433,6 +1433,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
|
|
||||||
- (void)exitRoom {
|
- (void)exitRoom {
|
||||||
[self.menuContainerView menuResignFirstResponder];
|
[self.menuContainerView menuResignFirstResponder];
|
||||||
|
[self.animationView resumeTimer];
|
||||||
if (self.roomInfo.roomModeType == RoomModeType_Open_Micro_Mode || self.roomInfo.roomModeType == RoomModeType_Open_Blind) {
|
if (self.roomInfo.roomModeType == RoomModeType_Open_Micro_Mode || self.roomInfo.roomModeType == RoomModeType_Open_Blind) {
|
||||||
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.roomInfo.uid];
|
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.roomInfo.uid];
|
||||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
#import "RechargeStorage.h"
|
#import "RechargeStorage.h"
|
||||||
#import "AccountModel.h"
|
#import "AccountModel.h"
|
||||||
#import "Api+Main.h"
|
#import "Api+Main.h"
|
||||||
|
#import "Api+Mine.h"
|
||||||
#import "MainProtocol.h"
|
#import "MainProtocol.h"
|
||||||
#import "NSObject+MJExtension.h"
|
#import "NSObject+MJExtension.h"
|
||||||
#import <NIMSDK/NIMSDK.h>
|
#import <NIMSDK/NIMSDK.h>
|
||||||
@@ -66,15 +67,24 @@ static NSString * kUpdateVersionNum = @"kUpdateVersionNum";
|
|||||||
|
|
||||||
- (void)checkTranscation {
|
- (void)checkTranscation {
|
||||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||||
|
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
||||||
NSArray * array = [RechargeStorage getAllReciptsWithUid:uid];
|
NSArray * array = [RechargeStorage getAllReciptsWithUid:uid];
|
||||||
if (array == nil || array.count <= 0) {
|
if (array == nil || array.count <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
NSString * transcationIdStr = [array toJSONString];
|
for (NSDictionary *transcation in array) {
|
||||||
[Api requestCheckTranscationIds:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
NSString *orderId = transcation[@"orderId"];
|
||||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
NSString *transcationId = transcation[@"transcationId"];
|
||||||
[RechargeStorage delegateAllTranscationIdsWithUid:uid];
|
///二次验证
|
||||||
}] transcationIdStr:transcationIdStr];
|
[Api checkReceipt:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||||
|
if (code == 200) {
|
||||||
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||||
|
[RechargeStorage delegateTranscationId:transcationId uid:uid];
|
||||||
|
}
|
||||||
|
|
||||||
|
} chooseEnv:@"true" chargeRecordId:orderId transcationId:transcationId uid:uid ticket:ticket];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -12,6 +12,14 @@
|
|||||||
|
|
||||||
#define AppName ([[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"])
|
#define AppName ([[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"])
|
||||||
|
|
||||||
|
#define isEnterprise \
|
||||||
|
({BOOL isEnterprise = NO;\
|
||||||
|
if (@available(iOS 11.0, *)) {\
|
||||||
|
NSString *bundleID = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"];\
|
||||||
|
isEnterprise = [bundleID isEqualToString:@"com.hflighting.yumi"];\
|
||||||
|
}\
|
||||||
|
(isEnterprise);})
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define NSLog(fmt,...) NSLog((@"%s [Line %d]" fmt),__PRETTY_FUNCTION__,__LINE__,##__VA_ARGS__)
|
#define NSLog(fmt,...) NSLog((@"%s [Line %d]" fmt),__PRETTY_FUNCTION__,__LINE__,##__VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
|
263
YuMi/Tools/PIIAPTool/PIIAPPayment.swift
Normal file
263
YuMi/Tools/PIIAPTool/PIIAPPayment.swift
Normal file
@@ -0,0 +1,263 @@
|
|||||||
|
//
|
||||||
|
// PIIAPPayment.swift
|
||||||
|
// YuMi
|
||||||
|
//
|
||||||
|
// Created by duoban on 2023/9/14.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
import StoreKit
|
||||||
|
|
||||||
|
@available(iOS 15.0, *)
|
||||||
|
typealias Transaction = StoreKit.Transaction
|
||||||
|
@available(iOS 15.0, *)
|
||||||
|
typealias RenewalInfo = StoreKit.Product.SubscriptionInfo.RenewalInfo
|
||||||
|
@available(iOS 15.0, *)
|
||||||
|
typealias RenewalState = StoreKit.Product.SubscriptionInfo.RenewalState
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
enum PIStoreError: Error {
|
||||||
|
|
||||||
|
|
||||||
|
// 错误回调枚举
|
||||||
|
case failedVerification
|
||||||
|
case noProduct
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc public enum StoreState: Int64 { // 支付状态
|
||||||
|
case start // 开始
|
||||||
|
case pay // 进行苹果支付
|
||||||
|
case verifiedServer // 服务器校验
|
||||||
|
case userCancelled // 用户取消
|
||||||
|
case pending // 等待(家庭用户才有的状态)
|
||||||
|
case unowned
|
||||||
|
case noProduct //没有商品
|
||||||
|
case failedVerification //验证失败
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@available(iOS 15.0, *)
|
||||||
|
public class PIIAPPayment: NSObject {
|
||||||
|
public typealias KStateBlock = (_ state :StoreState,_ param:Dictionary<String,Any>?) ->()
|
||||||
|
@objc public var stateBlock: KStateBlock! // 状态回调
|
||||||
|
|
||||||
|
var updateListenerTask: Task<Void, Error>? = nil // 支付事件监听
|
||||||
|
|
||||||
|
var transactionMap :[String:Transaction] // 用于完成Id的缓存map
|
||||||
|
|
||||||
|
var name: String = "iosStore" // 单例的写法
|
||||||
|
|
||||||
|
@objc public static let shared = {
|
||||||
|
let instance = PIIAPPayment()
|
||||||
|
return instance
|
||||||
|
}()
|
||||||
|
|
||||||
|
private override init() { // 单例需要保证private的私有性质
|
||||||
|
|
||||||
|
transactionMap = [:] // 初始化
|
||||||
|
super.init()
|
||||||
|
Task {
|
||||||
|
updateListenerTask = listenForTransactions()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 退订
|
||||||
|
@objc public func refunRequest(view: UIView,transactionId:UInt64) async{
|
||||||
|
do {
|
||||||
|
if let scene = await view.window?.windowScene{
|
||||||
|
try await Transaction.beginRefundRequest(for:transactionId , in: scene)
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch{
|
||||||
|
print("iap error")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 购买某个产品
|
||||||
|
@objc public func requestBuyProduct(productId:String, uuid: String) async throws {
|
||||||
|
if(stateBlock != nil ){
|
||||||
|
stateBlock(StoreState.start,nil)
|
||||||
|
}
|
||||||
|
do {
|
||||||
|
let list:[String] = [productId]
|
||||||
|
let storeProducts = try await Product.products(for: Set.init(list))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if storeProducts.count > 0 {
|
||||||
|
try await purchase(storeProducts[0],uuid)
|
||||||
|
}else {
|
||||||
|
print("iap: no found product")
|
||||||
|
if(stateBlock != nil ){
|
||||||
|
stateBlock(StoreState.noProduct,nil)
|
||||||
|
}
|
||||||
|
throw PIStoreError.noProduct // 没有该产品
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
print("Failed product request from the App Store server: \(error)")
|
||||||
|
if(stateBlock != nil ){
|
||||||
|
stateBlock(StoreState.noProduct,nil)
|
||||||
|
}
|
||||||
|
throw PIStoreError.noProduct // 没有该产品
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 购买
|
||||||
|
private func purchase(_ product: Product, _ uuid: String) async throws -> Transaction? {
|
||||||
|
if(stateBlock != nil ){
|
||||||
|
stateBlock(StoreState.pay,nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
guard let curUUID = UUID.init(uuidString: uuid) else{
|
||||||
|
|
||||||
|
if(stateBlock != nil ){
|
||||||
|
stateBlock(StoreState.failedVerification,nil)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
let getUUID = Product.PurchaseOption.appAccountToken(curUUID)
|
||||||
|
let result = try await product.purchase(options: [getUUID])
|
||||||
|
|
||||||
|
switch result {
|
||||||
|
case .success(let verification): // 用户购买完成
|
||||||
|
let transaction = try await verifiedAndFinish(verification)
|
||||||
|
return transaction
|
||||||
|
case .userCancelled: // 用户取消
|
||||||
|
if(stateBlock != nil ){
|
||||||
|
stateBlock(StoreState.userCancelled,nil)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
case .pending: // 此次购买被挂起
|
||||||
|
if(stateBlock != nil ){
|
||||||
|
stateBlock(StoreState.pending,nil)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
default:
|
||||||
|
if(stateBlock != nil ){
|
||||||
|
stateBlock(StoreState.unowned,nil)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验
|
||||||
|
func checkVerified<T>(_ result: VerificationResult<T>) throws -> T {
|
||||||
|
//Check whether the JWS passes StoreKit verification.
|
||||||
|
switch result {
|
||||||
|
case .unverified:
|
||||||
|
//StoreKit parses the JWS, but it fails verification.
|
||||||
|
if(stateBlock != nil ){
|
||||||
|
stateBlock(StoreState.failedVerification,nil)
|
||||||
|
}
|
||||||
|
throw PIStoreError.failedVerification
|
||||||
|
case .verified(let safe):
|
||||||
|
//The result is verified. Return the unwrapped value.
|
||||||
|
print("iap: verified success")
|
||||||
|
return safe
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验&完成后传给服务器
|
||||||
|
func verifiedAndFinish(_ verification:VerificationResult<Transaction>) async throws -> Transaction?{
|
||||||
|
//Check whether the transaction is verified. If it isn't,
|
||||||
|
//this function rethrows the verification error.
|
||||||
|
let transaction = try checkVerified(verification)
|
||||||
|
// 这里将订单提交给服务器进行验证 ~~~
|
||||||
|
let transactionId = try verification.payloadValue.id
|
||||||
|
|
||||||
|
// 添加进入待完成map
|
||||||
|
let key = String(transactionId)
|
||||||
|
transactionMap[key] = transaction
|
||||||
|
await uploadServer(for: transactionId)
|
||||||
|
|
||||||
|
// 这里不触发完成,等服务器验证再触发完成逻辑
|
||||||
|
await transaction.finish()
|
||||||
|
|
||||||
|
print("iap: finish")
|
||||||
|
return transaction
|
||||||
|
}
|
||||||
|
/*All transactions:全部的购买交易订单
|
||||||
|
Latest transactions:最新的购买交易订单。(分为订阅品项和除订阅品项外的所有类型二种)
|
||||||
|
Current entitlements:当前用户有购买的权限。(全部的订阅品项、和非消耗品项)
|
||||||
|
*/
|
||||||
|
func allTransaction(transactionId:String) async {
|
||||||
|
|
||||||
|
let transactionIntId = UInt64(transactionId)
|
||||||
|
for await result in Transaction.all {
|
||||||
|
do {
|
||||||
|
let tran = try checkVerified(result)
|
||||||
|
let resultId = try result.payloadValue.id
|
||||||
|
if transactionIntId == resultId {
|
||||||
|
await tran.finish()
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} catch let error {
|
||||||
|
|
||||||
|
print("error:----\(error)")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Transaction.latest(for: "pid")
|
||||||
|
|
||||||
|
}
|
||||||
|
// 事件完成处理
|
||||||
|
|
||||||
|
@objc public func transactionFinish(transaction:String) async{
|
||||||
|
if(transactionMap[transaction] != nil){
|
||||||
|
await transactionMap[transaction]!.finish()
|
||||||
|
transactionMap.removeValue(forKey: transaction)
|
||||||
|
print("transactionFinish end")
|
||||||
|
}else {
|
||||||
|
await allTransaction(transactionId: transaction)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@MainActor
|
||||||
|
func uploadServer(for transactionId:UInt64) async {
|
||||||
|
let dic :Dictionary<String,Any> = ["transactionId":transactionId]
|
||||||
|
if(stateBlock != nil ){
|
||||||
|
stateBlock(StoreState.verifiedServer,dic)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 支付监听事件
|
||||||
|
func listenForTransactions() -> Task<Void, Error> {
|
||||||
|
return Task.detached {
|
||||||
|
//Iterate through any transactions that don't come from a direct call to `purchase()`.
|
||||||
|
// 修改update 为 unfinished?
|
||||||
|
for await result in Transaction.updates { //会导致二次校验?
|
||||||
|
do {
|
||||||
|
print("iap: updates")
|
||||||
|
print("result:\(result)")
|
||||||
|
try await self.verifiedAndFinish(result)
|
||||||
|
} catch {
|
||||||
|
//StoreKit has a transaction that fails verification. Don't deliver content to the user.
|
||||||
|
print("Transaction failed verification")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//获取推广内购商品
|
||||||
|
func Promotion() async -> [SKProduct]?{
|
||||||
|
let promotion = SKProductStorePromotionController()
|
||||||
|
|
||||||
|
let prodicts = try? await promotion.promotionOrder()
|
||||||
|
return prodicts
|
||||||
|
}
|
||||||
|
// 销毁调用
|
||||||
|
deinit {
|
||||||
|
updateListenerTask?.cancel()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -118,7 +118,11 @@ static NSString *_from = nil;
|
|||||||
&& ![from isEqualToString:@""]) {
|
&& ![from isEqualToString:@""]) {
|
||||||
_from = from;
|
_from = from;
|
||||||
} else {
|
} else {
|
||||||
_from = @"appstore"; // App Store包
|
if (isEnterprise == NO) {
|
||||||
|
_from = @"piko_Enterprise"; // 企业包
|
||||||
|
}else {
|
||||||
|
_from = @"appstore"; // App Store包
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -513,6 +513,7 @@
|
|||||||
"XPIAPRechargeViewController5" = "如有任何问题请咨询客服,Piko号";
|
"XPIAPRechargeViewController5" = "如有任何问题请咨询客服,Piko号";
|
||||||
"XPIAPRechargeViewController6" = "我的账户";
|
"XPIAPRechargeViewController6" = "我的账户";
|
||||||
"XPIAPRechargeViewController7" = "未成年禁止充值消费!请勿轻易相信各类刷单、 退款等信息,以免上当受骗";
|
"XPIAPRechargeViewController7" = "未成年禁止充值消费!请勿轻易相信各类刷单、 退款等信息,以免上当受骗";
|
||||||
|
"XPIAPRechargeViewController8" = "储值失败。当前仅支持运行iOS15及以上系统的手机进行储值,请升级系统版本后重试。";
|
||||||
|
|
||||||
"XPMineRechargeViewController0" = "购买失败";
|
"XPMineRechargeViewController0" = "购买失败";
|
||||||
"XPMineRechargeViewController1" = "出现未知错误,请重新尝试";
|
"XPMineRechargeViewController1" = "出现未知错误,请重新尝试";
|
||||||
|
@@ -521,6 +521,7 @@
|
|||||||
"XPIAPRechargeViewController5" = "如有任何問題請咨詢客服,Piko號";
|
"XPIAPRechargeViewController5" = "如有任何問題請咨詢客服,Piko號";
|
||||||
"XPIAPRechargeViewController6" = "我的賬戶";
|
"XPIAPRechargeViewController6" = "我的賬戶";
|
||||||
"XPIAPRechargeViewController7" = "未成年禁止充值消費!請勿輕易相信各類刷單、 退款等信息,以免上當受騙";
|
"XPIAPRechargeViewController7" = "未成年禁止充值消費!請勿輕易相信各類刷單、 退款等信息,以免上當受騙";
|
||||||
|
"XPIAPRechargeViewController8" = "儲值失敗。當前僅支持運行iOS15及以上系統的手機進行儲值,請升級系統版本後重試。";
|
||||||
|
|
||||||
"XPMineRechargeViewController0" = "購買失敗";
|
"XPMineRechargeViewController0" = "購買失敗";
|
||||||
"XPMineRechargeViewController1" = "出現未知錯誤,請重新嘗試";
|
"XPMineRechargeViewController1" = "出現未知錯誤,請重新嘗試";
|
||||||
|
Reference in New Issue
Block a user