塔罗原生支付
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#import "XPMineNewRechargeViewController.h"
|
||||
#import "NSMutableDictionary+Saft.h"
|
||||
#import "Base64.h"
|
||||
#import <WXApi.h>
|
||||
///vc
|
||||
#import "XPMineDressUpViewController.h"
|
||||
#import "XPDressUpShopViewController.h"
|
||||
@@ -108,6 +109,7 @@ NSString * const kProhibitRightSlip = @"prohibitRightSlip";
|
||||
NSString * const kSaveBase64Image = @"saveBase64Image";
|
||||
NSString * const kOpenDialogWebview = @"openDialogWebview";
|
||||
NSString * const kCheckResultFinish = @"checkResultFinish";
|
||||
NSString * const kOpenNativeTarotPay = @"openNativeTarotPay";
|
||||
|
||||
@implementation XPWebViewController
|
||||
|
||||
@@ -402,7 +404,39 @@ NSString * const kCheckResultFinish = @"checkResultFinish";
|
||||
NSString * body = message.body;
|
||||
///这个为什么不能直接调用下面的的方法?收到这个刷新的方法的是当前半屏的这个webview 但是刷新的话是刷新 打开塔罗牌的那个webView
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:kCheckResultFinish object:body];
|
||||
}
|
||||
} else if([message.name isEqualToString:kOpenNativeTarotPay]) {
|
||||
NSDictionary *bodyDict;
|
||||
if ([message.body isKindOfClass:[NSDictionary class]]) {
|
||||
bodyDict = message.body;
|
||||
} else if ([message.body isKindOfClass:[NSString class]]) {
|
||||
NSString *str = (NSString *)message.body;
|
||||
bodyDict = [str toJSONObject];
|
||||
}
|
||||
NSLog(@"%@",bodyDict);
|
||||
// 微信支付
|
||||
[WXApi registerApp:bodyDict[@"appid"] universalLink:@"https://f02efc69cbad775287063e8ee37733a5.share2dlink.com/"];
|
||||
|
||||
PayReq *req = [[PayReq alloc] init];
|
||||
NSMutableString *stamp = [bodyDict objectForKey:@"timestamp"];
|
||||
req.partnerId = [bodyDict objectForKey:@"partnerid"];
|
||||
req.prepayId = [bodyDict objectForKey:@"prepayid"];
|
||||
req.nonceStr = [bodyDict objectForKey:@"noncestr"];
|
||||
req.timeStamp = stamp.intValue;
|
||||
req.package = [bodyDict objectForKey:@"package"];
|
||||
req.sign = [bodyDict objectForKey:@"sign"];
|
||||
[WXApi sendReq:req completion:^(BOOL success) {
|
||||
if (success) {
|
||||
NSLog(@"********调起微信支付成功");
|
||||
}
|
||||
}];
|
||||
|
||||
XPEnterpriseTarotPayView *alert = [[XPEnterpriseTarotPayView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth - 37 * 2, 200)];
|
||||
alert.url = bodyDict[@"url"];
|
||||
TTPopupService * service = [[TTPopupService alloc] init];
|
||||
service.shouldDismissOnBackgroundTouch = NO;
|
||||
service.contentView = alert;
|
||||
[TTPopup popupWithConfig:service];
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
@@ -747,6 +781,7 @@ NSString * const kCheckResultFinish = @"checkResultFinish";
|
||||
// 卡罗牌
|
||||
[_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kOpenDialogWebview];
|
||||
[_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kCheckResultFinish];
|
||||
[_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kOpenNativeTarotPay];
|
||||
}
|
||||
return _userContentController;
|
||||
}
|
||||
|
Reference in New Issue
Block a user