|
|
@@ -111,11 +111,8 @@
|
|
|
WeakSelf
|
|
|
[self.httpsManager POSTWithParameters:parmDict SuccessBlock:^(NSDictionary *responseJson)
|
|
|
{
|
|
|
- if ((NSNull *)responseJson != [NSNull null])
|
|
|
- {
|
|
|
-
|
|
|
- weakSelf.scrollView.diamondStr = [NSString stringWithFormat:@"%@",[responseJson objectForKey:@"diamonds"]];
|
|
|
- }
|
|
|
+ NSInteger diamonds = [[responseJson objectForKey:@"diamonds"] integerValue];
|
|
|
+ [weakSelf.scrollView updateDiamonds:diamonds];
|
|
|
} FailureBlock:^(NSError *error)
|
|
|
{
|
|
|
|
|
|
@@ -262,7 +259,7 @@
|
|
|
NSString *base64String = [data base64EncodedStringWithOptions:0];
|
|
|
if ([productIdentifier length] > 0) {
|
|
|
// 向自己的服务器验证购买凭证
|
|
|
- [self shoppingValidation:base64String];
|
|
|
+ [self shoppingValidation:base64String retryCount:3];
|
|
|
}
|
|
|
// Remove the transaction from the payment queue.
|
|
|
[SVProgressHUD dismiss];
|
|
|
@@ -270,8 +267,13 @@
|
|
|
}
|
|
|
|
|
|
#pragma mark -- 向自己的服务器验证购买凭证
|
|
|
-- (void)shoppingValidation : (NSString *)base64Str
|
|
|
+- (void)shoppingValidation : (NSString *)base64Str retryCount:(NSInteger)retryCount
|
|
|
{
|
|
|
+ retryCount--;
|
|
|
+ if (retryCount <= 0) {
|
|
|
+ [FanweMessage alert:ASLocalizedString(@"支付失败")];
|
|
|
+ return;
|
|
|
+ }
|
|
|
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity:0];
|
|
|
// if (_is_vip)
|
|
|
// {
|
|
|
@@ -286,10 +288,15 @@
|
|
|
[dict setObject:userid forKey:@"user_id"];
|
|
|
[dict setObject:base64Str forKey:@"receipt-data"];
|
|
|
[self.httpsManager POSTWithParameters:dict SuccessBlock:^(NSDictionary *responseJson) {
|
|
|
+ NSInteger diamonds = [[responseJson objectForKey:@"total_diamonds"] integerValue];
|
|
|
+ [self.scrollView updateDiamonds:diamonds];
|
|
|
[self reloadAcount];
|
|
|
- // [FanweMessage alert:ASLocalizedString(@"充值成功")];
|
|
|
- } FailureBlock:^(NSError *error) {
|
|
|
+ [FanweMessage alert:ASLocalizedString(@"充值成功")];
|
|
|
|
|
|
+ } FailureBlock:^(NSError *error) {
|
|
|
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
+ [self shoppingValidation:base64Str retryCount:retryCount];
|
|
|
+ });
|
|
|
}];
|
|
|
}
|
|
|
|