zwp пре 7 месеци
родитељ
комит
222dd1fcc3

+ 16 - 9
BuguLive/Class/Sections/Home/V3NewUIController/NewRechargeUI/Controller/BogoRechargeViewController.m

@@ -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];
+        });
     }];
 }
 

+ 2 - 2
BuguLive/Class/Sections/Home/V3NewUIController/NewRechargeUI/View/BogoRechargePayMoneyCell.m

@@ -26,12 +26,12 @@
     
     if([[[NSBundle mainBundle]bundleIdentifier] isEqualToString:@"com.zebo.zebolive"])
     {
-        self.numberL.text = [NSString stringWithFormat:@"INR%@",model.money];
+        self.numberL.text = [NSString stringWithFormat:@"INR%@",model.iap_money];
 
     }
     else
     {
-        self.numberL.text = [NSString stringWithFormat:@"$%@",model.money];
+        self.numberL.text = [NSString stringWithFormat:@"$%@",model.iap_money];
 
     }
     

+ 1 - 1
BuguLive/Class/Sections/Home/V3NewUIController/NewRechargeUI/View/BogoRechargePayMoneyCollection.m

@@ -70,7 +70,7 @@
 }
 
 - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
-    return 1;//self.listArr.count;//第一个版本先上一个应用内购买包,后续再增时修改
+    return self.listArr.count;
 }
 
 - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {

+ 3 - 1
BuguLive/Class/Sections/Home/V3NewUIController/NewRechargeUI/View/BogoRechargeScrollView.h

@@ -30,10 +30,12 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property(nonatomic, strong) id<BogoRechargeDelegate> reDelegate;
 
-@property(nonatomic, strong) NSString *diamondStr;
+//@property(nonatomic, strong) NSString *diamondStr;
 
 @property(nonatomic, assign) BOOL isRecharge;
 
+- (void)updateDiamonds:(NSInteger)diamonds;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 4 - 0
BuguLive/Class/Sections/Home/V3NewUIController/NewRechargeUI/View/BogoRechargeScrollView.m

@@ -216,6 +216,10 @@
     }];
 }
 
+- (void)updateDiamonds:(NSInteger)diamonds {
+    self.topView.numerLabel.text = [NSString stringWithFormat:@"%ld",diamonds];
+}
+
 #pragma mark - 点击事件