This commit is contained in:
2025-12-22 19:19:28 +08:00
parent 5cfc76e6c5
commit 4e6fd90668
20 changed files with 679 additions and 3 deletions

View File

@@ -158,6 +158,47 @@ NSString * const KBUserCharacterDeletedNotification = @"KBUserCharacterDeletedNo
}];
}
- (void)fetchWalletTransactionsWithPage:(NSInteger)pageNum
pageSize:(NSInteger)pageSize
completion:(KBMyPurchaseRecordCompletion)completion {
NSInteger safePageNum = pageNum > 0 ? pageNum : 1;
NSInteger safePageSize = pageSize > 0 ? pageSize : 10;
NSDictionary *body = @{
@"pageNum": @(safePageNum),
@"pageSize": @(safePageSize)
};
[[KBNetworkManager shared] POST:API_WALLET_TRANSACTIONS
jsonBody:body
headers:nil
autoShowBusinessError:NO
completion:^(NSDictionary * _Nullable json,
NSURLResponse * _Nullable response,
NSError * _Nullable error) {
if (error) {
if (completion) completion(nil, error);
return;
}
id dataObj = json[KBData] ?: json[@"data"];
if (![dataObj isKindOfClass:[NSDictionary class]]) {
NSError *e = [NSError errorWithDomain:KBNetworkErrorDomain
code:KBNetworkErrorInvalidResponse
userInfo:@{NSLocalizedDescriptionKey: KBLocalized(@"Invalid response")}];
if (completion) completion(nil, e);
return;
}
id recordsObj = [(NSDictionary *)dataObj objectForKey:@"records"];
if (![recordsObj isKindOfClass:[NSArray class]]) {
NSError *e = [NSError errorWithDomain:KBNetworkErrorDomain
code:KBNetworkErrorInvalidResponse
userInfo:@{NSLocalizedDescriptionKey: KBLocalized(@"Invalid response")}];
if (completion) completion(nil, e);
return;
}
NSArray<KBConsumptionRecord *> *records = [KBConsumptionRecord mj_objectArrayWithKeyValuesArray:(NSArray *)recordsObj];
if (completion) completion(records, nil);
}];
}
- (void)fetchDownloadedThemesWithCompletion:(KBMyPurchasedThemesCompletion)completion {
dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{
NSArray<KBSkinDownloadRecord *> *records = [KBSkinInstallBridge installedSkinRecords];