贵族充值页需要支付宝微信

This commit is contained in:
fengshuo
2022-05-17 21:04:50 +08:00
parent 838421446a
commit 8c40858c15
11 changed files with 58 additions and 31 deletions

View File

@@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
/// @param clientIp ip /// @param clientIp ip
/// @param uid uid /// @param uid uid
/// @param ticket ticket /// @param ticket ticket
+ (void)requestPay:(HttpRequestHelperCompletion)completion chargeProdId:(NSString *)chargeProdId payChannel:(NSString *)payChannel clientIp:(NSString *)clientIp uid:(NSString *)uid ticket:(NSString *)ticket; + (void)requestPay:(HttpRequestHelperCompletion)completion chargeProdId:(NSString *)chargeProdId payChannel:(NSString *)payChannel clientIp:(NSString *)clientIp uid:(NSString *)uid ticket:(NSString *)ticket roomUid:(NSString *)roomUid;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -22,14 +22,19 @@
/// @param clientIp ip /// @param clientIp ip
/// @param uid uid /// @param uid uid
/// @param ticket ticket /// @param ticket ticket
+ (void)requestPay:(HttpRequestHelperCompletion)completion chargeProdId:(NSString *)chargeProdId payChannel:(NSString *)payChannel clientIp:(NSString *)clientIp uid:(NSString *)uid ticket:(NSString *)ticket { + (void)requestPay:(HttpRequestHelperCompletion)completion chargeProdId:(NSString *)chargeProdId payChannel:(NSString *)payChannel clientIp:(NSString *)clientIp uid:(NSString *)uid ticket:(NSString *)ticket roomUid:(NSString *)roomUid {
NSMutableDictionary * dic = [NSMutableDictionary dictionary]; NSMutableDictionary * dic = [NSMutableDictionary dictionary];
[dic safeSetObject:chargeProdId forKey:@"chargeProdId"]; [dic setValue:chargeProdId forKey:@"chargeProdId"];
[dic safeSetObject:payChannel forKey:@"payChannel"]; [dic setValue:payChannel forKey:@"payChannel"];
[dic safeSetObject:clientIp forKey:@"clientIp"]; [dic setValue:clientIp forKey:@"clientIp"];
[dic safeSetObject:uid forKey:@"uid"]; [dic setValue:uid forKey:@"uid"];
[dic safeSetObject:ticket forKey:@"ticket"]; [dic setValue:ticket forKey:@"ticket"];
if (roomUid.integerValue> 0) {
[dic setValue:roomUid forKey:@"roomUid"];
}
[HttpRequestHelper request:@"charge/pay/apply" method:HttpRequestHelperMethodPOST params:dic completion:completion]; [HttpRequestHelper request:@"charge/pay/apply" method:HttpRequestHelperMethodPOST params:dic completion:completion];
} }
@end @end

View File

@@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
/// 获取钱包信息 /// 获取钱包信息
- (void)getUserWalletInfo; - (void)getUserWalletInfo;
///发起支付 ///发起支付
- (void)requestPay:(NSString *)chargeProdId payChannel:(NSString *)payChannel; - (void)requestPay:(NSString *)chargeProdId payChannel:(NSString *)payChannel roomUid:(NSString *)roomUid;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -34,12 +34,12 @@
} }
/// ///
- (void)requestPay:(NSString *)chargeProdId payChannel:(NSString *)payChannel { - (void)requestPay:(NSString *)chargeProdId payChannel:(NSString *)payChannel roomUid:(NSString *)roomUid {
NSString * uid = [AccountInfoStorage instance].getUid; NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [AccountInfoStorage instance].getTicket; NSString * ticket = [AccountInfoStorage instance].getTicket;
NSString * clientIp= [YYUtility ipAddress]; NSString * clientIp= [YYUtility ipAddress];
[Api requestPay:[self createHttpCompletion:^(BaseModel * _Nonnull data) { [Api requestPay:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] requestPaySuccess:data.data payChannel:payChannel]; [[self getView] requestPaySuccess:data.data payChannel:payChannel];
} showLoading:YES] chargeProdId:chargeProdId payChannel:payChannel clientIp:clientIp uid:uid ticket:ticket]; } showLoading:YES] chargeProdId:chargeProdId payChannel:payChannel clientIp:clientIp uid:uid ticket:ticket roomUid:roomUid];
} }
@end @end

View File

@@ -8,12 +8,16 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@class FirstRechargeModel;
@interface XPEnterpriseFirstRechargePayView : UIView @interface XPEnterpriseFirstRechargePayView : UIView
///充值信息 ///充值的id
@property (nonatomic,strong) FirstRechargeModel *rechargeInfo; @property (nonatomic,copy) NSString *chargeProdId;
///充值的金额
@property (nonatomic,copy) NSString *chargeMoney;
///房主的uid
@property (nonatomic,copy) NSString *roomUid;
///首充的vc ///首充的vc
@property (nonatomic,weak) UIViewController *firstrechargeVC; @property (nonatomic,weak) UIViewController *firstrechargeVC;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -23,7 +23,6 @@
#import "TTPopup.h" #import "TTPopup.h"
///Model ///Model
#import "EnterpriseRechargeListInfoModel.h" #import "EnterpriseRechargeListInfoModel.h"
#import "FirstRechargeModel.h"
#import "EnterPrieseRechargeTypeItemModel.h" #import "EnterPrieseRechargeTypeItemModel.h"
///View ///View
#import "XPEnterpriseRechargePayTableViewCell.h" #import "XPEnterpriseRechargePayTableViewCell.h"
@@ -153,14 +152,21 @@
if ([payChannel isEqualToString:@"alipay_v2"]) { if ([payChannel isEqualToString:@"alipay_v2"]) {
if ([infoData isKindOfClass:[NSDictionary class]]) { if ([infoData isKindOfClass:[NSDictionary class]]) {
if ([[infoData objectForKey:@"payType"] isEqualToString:@"h5"]) { if ([[infoData objectForKey:@"payType"] isEqualToString:@"h5"]) {
[self.firstrechargeVC dismissViewControllerAnimated:NO completion:^{ if (self.firstrechargeVC) {
[self.firstrechargeVC dismissViewControllerAnimated:NO completion:^{
XPWebViewController *webView = [[XPWebViewController alloc] init];
webView.url = [infoData objectForKey:@"orderData"];
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:webView animated:YES];
}];
} else {
XPWebViewController *webView = [[XPWebViewController alloc] init]; XPWebViewController *webView = [[XPWebViewController alloc] init];
webView.url = [infoData objectForKey:@"orderData"]; webView.url = [infoData objectForKey:@"orderData"];
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:webView animated:YES]; [[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:webView animated:YES];
}]; }
}else if ([[infoData objectForKey:@"payType"] isEqualToString:@"native"]) { }else if ([[infoData objectForKey:@"payType"] isEqualToString:@"native"]) {
[self.firstrechargeVC dismissViewControllerAnimated:NO completion:nil]; if (self.firstrechargeVC) {
[self.firstrechargeVC dismissViewControllerAnimated:NO completion:nil];
}
NSString * signedStr = [infoData objectForKey:@"orderData"]; NSString * signedStr = [infoData objectForKey:@"orderData"];
NSString * scheme = @"daeplayappp"; NSString * scheme = @"daeplayappp";
[[AlipaySDK defaultService] payOrder:signedStr fromScheme:scheme callback:^(NSDictionary *resultDic) { [[AlipaySDK defaultService] payOrder:signedStr fromScheme:scheme callback:^(NSDictionary *resultDic) {
@@ -169,7 +175,9 @@
} }
} }
} else if ([payChannel isEqualToString:@"alipay"]) { } else if ([payChannel isEqualToString:@"alipay"]) {
[self.firstrechargeVC dismissViewControllerAnimated:NO completion:nil]; if (self.firstrechargeVC) {
[self.firstrechargeVC dismissViewControllerAnimated:NO completion:nil];
}
if ([data isKindOfClass:[NSString class]]) { if ([data isKindOfClass:[NSString class]]) {
NSString * scheme = @"daeplayappp"; NSString * scheme = @"daeplayappp";
NSString * signedStr = [infoData objectForKey:@"orderData"]; NSString * signedStr = [infoData objectForKey:@"orderData"];
@@ -179,7 +187,9 @@
} }
}else if ([payChannel isEqualToString:@"wx"]){ }else if ([payChannel isEqualToString:@"wx"]){
if ([infoData isKindOfClass:[NSDictionary class]]) { if ([infoData isKindOfClass:[NSDictionary class]]) {
[self.firstrechargeVC dismissViewControllerAnimated:NO completion:nil]; if (self.firstrechargeVC) {
[self.firstrechargeVC dismissViewControllerAnimated:NO completion:nil];
}
PayReq *req = [[PayReq alloc] init]; PayReq *req = [[PayReq alloc] init];
NSDictionary * dict = infoData; NSDictionary * dict = infoData;
NSMutableString *stamp = [dict objectForKey:@"timestamp"]; NSMutableString *stamp = [dict objectForKey:@"timestamp"];
@@ -200,14 +210,14 @@
} else { } else {
[XCHUDTool showErrorWithMessage:msg]; [XCHUDTool showErrorWithMessage:msg];
} }
} chargeProdId:self.rechargeInfo.chargeProdId payChannel:payChannel clientIp:clientIp uid:uid ticket:ticket]; } chargeProdId:self.chargeProdId payChannel:payChannel clientIp:clientIp uid:uid ticket:ticket roomUid:self.roomUid];
} }
#pragma mark - Getters And Setters #pragma mark - Getters And Setters
- (void)setRechargeInfo:(FirstRechargeModel *)rechargeInfo { - (void)setChargeMoney:(NSString *)chargeMoney {
_rechargeInfo = rechargeInfo; _chargeMoney = chargeMoney;
if (_rechargeInfo) { if (_chargeMoney.length > 0) {
self.moneyLabel.text = [NSString stringWithFormat:@"¥%ld", rechargeInfo.chargeMoney]; self.moneyLabel.text = [NSString stringWithFormat:@"¥%@", _chargeMoney];
} }
} }

View File

@@ -10,7 +10,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface XPMineRechargeViewController : MvpViewController @interface XPMineRechargeViewController : MvpViewController
@property (nonatomic,copy) NSString *roomUid;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -176,7 +176,7 @@
self.currentItem = cell.currentItem; self.currentItem = cell.currentItem;
} }
NSString * payType= self.currentItem.type == RechargeType_WX ? @"wx" : @"alipay_v2"; NSString * payType= self.currentItem.type == RechargeType_WX ? @"wx" : @"alipay_v2";
[self.presenter requestPay:self.rechargeInfo.chargeProdId payChannel:payType]; [self.presenter requestPay:self.rechargeInfo.chargeProdId payChannel:payType roomUid:self.roomUid];
} }
} }

View File

@@ -34,6 +34,7 @@
#import "XPNobleSettingViewController.h" #import "XPNobleSettingViewController.h"
#import "XPNobleRankViewController.h" #import "XPNobleRankViewController.h"
#import "XPNobleDiscountView.h" #import "XPNobleDiscountView.h"
#import "XPEnterpriseFirstRechargePayView.h"
///P ///P
#import "XPNobleCenterPresenter.h" #import "XPNobleCenterPresenter.h"
///model ///model
@@ -173,7 +174,7 @@
- (void)requestHttp { - (void)requestHttp {
[self.presenter getUserInfo]; [self.presenter getUserInfo];
[self checkTranscationIds]; [self checkTranscationIds];
[self.presenter getNobleChargeProductListWithChannelType:@"10"]; [self.presenter getNobleChargeProductListWithChannelType:@"9"];
} }
/// ///
@@ -383,8 +384,11 @@
- (void)onOpenNobleButtonClick:(UITapGestureRecognizer *)button { - (void)onOpenNobleButtonClick:(UITapGestureRecognizer *)button {
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventVipOpenClick]; [StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventVipOpenClick];
RechargeListModel *rechargeModel = [self.rechargeModel.list safeObjectAtIndex1:0]; RechargeListModel *rechargeModel = [self.rechargeModel.list safeObjectAtIndex1:0];
[self showLoading]; XPEnterpriseFirstRechargePayView * rechargetView =[[XPEnterpriseFirstRechargePayView alloc] init];
[self.presenter requestNobleIAPRechargeOrderWithChargeProdId:rechargeModel.chargeProdId roomUid:self.roomUid ? [NSString stringWithFormat:@"%zd", self.roomUid] : nil]; rechargetView.chargeMoney = rechargeModel.money.stringValue;
rechargetView.chargeProdId = rechargeModel.chargeProdId;
rechargetView.roomUid = [NSString stringWithFormat:@"%ld",self.roomUid];
[TTPopup popupView:rechargetView style:TTPopupStyleActionSheet];
} }
- (void)nobleRankButtonAction:(UIButton *)sender { - (void)nobleRankButtonAction:(UIButton *)sender {

View File

@@ -409,6 +409,9 @@
- (void)xPGiftBarViewDidClickRecharge:(XPGiftBarView *)view { - (void)xPGiftBarViewDidClickRecharge:(XPGiftBarView *)view {
[self dismissViewControllerAnimated:NO completion:^{ [self dismissViewControllerAnimated:NO completion:^{
XPMineRechargeViewController * rechargeVC = [[XPMineRechargeViewController alloc] init]; XPMineRechargeViewController * rechargeVC = [[XPMineRechargeViewController alloc] init];
if (self.delegate.getRoomInfo) {
rechargeVC.roomUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid];
}
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:rechargeVC animated:YES]; [[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:rechargeVC animated:YES];
}]; }];
} }

View File

@@ -229,7 +229,8 @@
- (void)rechargeButtonAction:(UIButton *)sender { - (void)rechargeButtonAction:(UIButton *)sender {
XPEnterpriseFirstRechargePayView * rechargetView =[[XPEnterpriseFirstRechargePayView alloc] init]; XPEnterpriseFirstRechargePayView * rechargetView =[[XPEnterpriseFirstRechargePayView alloc] init];
rechargetView.rechargeInfo = self.selectRechargeInfo; rechargetView.chargeMoney = [NSString stringWithFormat:@"%ld", self.selectRechargeInfo.chargeMoney];
rechargetView.chargeProdId = self.selectRechargeInfo.chargeProdId;
rechargetView.firstrechargeVC = self; rechargetView.firstrechargeVC = self;
[TTPopup popupView:rechargetView style:TTPopupStyleActionSheet]; [TTPopup popupView:rechargetView style:TTPopupStyleActionSheet];