This commit is contained in:
2025-12-12 16:09:14 +08:00
parent 2b08dd44ee
commit 437f796a08
6 changed files with 12 additions and 7 deletions

View File

@@ -73,6 +73,9 @@ typedef NS_ENUM(NSInteger, KBBizCode) {
/// 操作失败OPERATION_ERROR(50001, "操作失败") /// 操作失败OPERATION_ERROR(50001, "操作失败")
KBBizCodeOperationError = 50001, KBBizCodeOperationError = 50001,
/// 特定收据无效
KBBizCodeReceiptError = 50016,
}; };
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN

View File

@@ -65,7 +65,7 @@
<EnvironmentVariable <EnvironmentVariable
key = "OS_ACTIVITY_MODE" key = "OS_ACTIVITY_MODE"
value = "disable" value = "disable"
isEnabled = "NO"> isEnabled = "YES">
</EnvironmentVariable> </EnvironmentVariable>
</EnvironmentVariables> </EnvironmentVariables>
</LaunchAction> </LaunchAction>

View File

@@ -458,7 +458,7 @@ autoShowBusinessError:YES
NSLocalizedDescriptionKey : msg, NSLocalizedDescriptionKey : msg,
@"code" : @(bizCode) @"code" : @(bizCode)
}]; }];
// if (completion) completion(dict, response, bizErr); if (completion) completion(dict, response, bizErr);
return; return;
} }
// code // code

View File

@@ -36,7 +36,6 @@
#else #else
type = 1; type = 1;
#endif #endif
// , @"type": @(type) // , @"type": @(type)
NSDictionary *params = @{ @"receipt": receipt ?: @""}; NSDictionary *params = @{ @"receipt": receipt ?: @""};
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
@@ -47,7 +46,9 @@
[[SKPaymentQueue defaultQueue] finishTransaction:transaction]; [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
[KBHUD showSuccess:@"Success"]; [KBHUD showSuccess:@"Success"];
if (handler) handler(KBLocalized(@"Success"), nil); if (handler) handler(KBLocalized(@"Success"), nil);
} else { }else if(sta == KBBizCodeReceiptError){
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
}else {
[KBHUD showError:@"Failed"]; [KBHUD showError:@"Failed"];
if (handler) handler(KBLocalized(@"Failed"), nil); if (handler) handler(KBLocalized(@"Failed"), nil);
} }

View File

@@ -16,11 +16,11 @@
completion:(KBPayCompletion)completion { completion:(KBPayCompletion)completion {
if (needShow) { [KBHUD show]; } if (needShow) { [KBHUD show]; }
[[KBNetworkManager shared] POST:API_VALIDATE_RECEIPT jsonBody:params headers:nil completion:^(NSDictionary * _Nullable json, NSURLResponse * _Nullable response, NSError * _Nullable error) { [[KBNetworkManager shared] POST:API_VALIDATE_RECEIPT jsonBody:params headers:nil autoShowBusinessError:false completion:^(NSDictionary * _Nullable json, NSURLResponse * _Nullable response, NSError * _Nullable error) {
if (needShow) { [KBHUD dismiss]; } if (needShow) { [KBHUD dismiss]; }
if (error) { if (error) {
// if (completion) completion(ERROR_CODE, error.localizedDescription ?: KBLocalized(@"Network error")); if (completion) completion(ERROR_CODE, error.localizedDescription ?: KBLocalized(@"Network error"));
return; return;
} }

View File

@@ -54,7 +54,8 @@
#if DEBUG #if DEBUG
#define KBLOG(fmt, ...) do { \ #define KBLOG(fmt, ...) do { \
NSString *kb_msg__ = [NSString stringWithFormat:(fmt), ##__VA_ARGS__]; \ NSString *kb_msg__ = [NSString stringWithFormat:(fmt), ##__VA_ARGS__]; \
NSLog(@"\n==============================[KB DEBUG]==============================\n[Function] %s\n[Line] %d\n%@\n=====================================================================\n", __PRETTY_FUNCTION__, __LINE__, kb_msg__); \ NSString *kb_full_msg__ = [NSString stringWithFormat:@"\n==============================[KB DEBUG]==============================\n[Function] %s\n[Line] %d\n%@\n=====================================================================\n", __PRETTY_FUNCTION__, __LINE__, kb_msg__]; \
fprintf(stderr, "%s", kb_full_msg__.UTF8String); \
} while(0) } while(0)
#else #else
#define KBLOG(...) #define KBLOG(...)