|
@@ -49,8 +49,10 @@ JSExportAs(backUrl, -(void)jsBackUrl:(NSString*)str);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-//测试支付
|
|
|
|
-JSExportAs(payment, -(void)jsPayment:(NSString*)str);
|
|
|
|
|
|
+//支付相关
|
|
|
|
+JSExportAs(wxPay, -(void)jsWxPay:(NSString *)jsonString);
|
|
|
|
+JSExportAs(aliPay, -(void)jsAliPay:(NSString*)str);
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
JSExportAs(clearPushMessage, -(void)jsClearPushMessage:(NSString*)type);
|
|
JSExportAs(clearPushMessage, -(void)jsClearPushMessage:(NSString*)type);
|
|
@@ -117,6 +119,11 @@ NSString *const AesKey_3 = @"mGlAgnIBB8bx2nch";
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(requestWebView:) name:kRequestWebViewWithUrl object:nil];
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(requestWebView:) name:kRequestWebViewWithUrl object:nil];
|
|
//点击订阅通知
|
|
//点击订阅通知
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(clickSubNotiMethods:) name:ClickSubNotiMethods object:nil];
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(clickSubNotiMethods:) name:ClickSubNotiMethods object:nil];
|
|
|
|
+ //点击支付通知
|
|
|
|
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(clickPayMethods:) name:ClickPayMethods object:nil];
|
|
|
|
+
|
|
|
|
+ //支付状态通知
|
|
|
|
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(alipayWXpayStatus:) name:AlipayWXpayStatus object:nil];
|
|
|
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateNotifyState) name:kUpdateNotifyState object:nil];
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateNotifyState) name:kUpdateNotifyState object:nil];
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(afterReceiveNewMsg) name:kAfterReceiveNewMsg object:nil];
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(afterReceiveNewMsg) name:kAfterReceiveNewMsg object:nil];
|
|
@@ -355,6 +362,41 @@ NSString *const AesKey_3 = @"mGlAgnIBB8bx2nch";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+//点击支付通知
|
|
|
|
+-(void)clickPayMethods:(NSNotification *)notification{
|
|
|
|
+ NSDictionary * infoDict = [notification object][@"info"];
|
|
|
|
+ if (!infoDict) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
|
|
|
|
+ NSArray * array = [urlStr componentsSeparatedByString:@"=="];
|
|
|
|
+ urlStr = [array.firstObject stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
|
|
|
+ NSString * titleStr = @"消息通知";
|
|
|
|
+ titleStr = [NSString stringWithFormat:@"%@",infoDict[@"title"]];
|
|
|
|
+ if (urlStr) {
|
|
|
|
+ if(self.tabBarController.selectedIndex == 3) {
|
|
|
|
+ [self jsOpenExternalLink:urlStr title:titleStr];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#pragma mark 收到z支付通知
|
|
|
|
+-(void)alipayWXpayStatus:(NSNotification *)notification{
|
|
|
|
+
|
|
|
|
+ NSString * status = [notification object];
|
|
|
|
+ [self performSelector:@selector(payStatus:) withObject:status afterDelay:2];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+-(void)payStatus:(NSString *)status
|
|
|
|
+{
|
|
|
|
+ //目前延时两秒
|
|
|
|
+ NSLog(@"支付状态:%@",status);
|
|
|
|
+ JSContext *context = [self.webView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"];
|
|
|
|
+ NSString * textJS1 = [NSString stringWithFormat:@"payCallBack('%@')", status];
|
|
|
|
+ [context evaluateScript:textJS1];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
-(void)pushDY:(NSDictionary *)infoDict
|
|
-(void)pushDY:(NSDictionary *)infoDict
|
|
{
|
|
{
|
|
[[NSNotificationCenter defaultCenter] postNotificationName:@"refreshDY" object:nil userInfo:infoDict];
|
|
[[NSNotificationCenter defaultCenter] postNotificationName:@"refreshDY" object:nil userInfo:infoDict];
|
|
@@ -941,43 +983,6 @@ NSString *const AesKey_3 = @"mGlAgnIBB8bx2nch";
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
--(void)jsPayment:(NSString*)str
|
|
|
|
-{
|
|
|
|
- NSLog(@"支付");
|
|
|
|
- return;
|
|
|
|
- NSDictionary *data = @{ @"appId":@"wx0e6a5b18f4cfd10d",
|
|
|
|
- @"nonceStr":@"ZMZqGVibnrQSGlmq",
|
|
|
|
- @"partnerid":@"1513535801",
|
|
|
|
- @"paySign":@"046AFF278351BD5B685F153057B61CF9",
|
|
|
|
- @"prepay_id":@"wx241022000493643eb8db09901655699181",
|
|
|
|
- @"timeStamp":@"1543026120",
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- {
|
|
|
|
- appId = wx0666de5698bc8d59;
|
|
|
|
- nonceStr = ZMZqGVibnrQSGlmq;
|
|
|
|
- "order_no" = AB24261197794989;
|
|
|
|
- partnerid = 1513535801;
|
|
|
|
- paySign = 046AFF278351BD5B685F153057B61CF9;
|
|
|
|
- "prepay_id" = wx241022000493643eb8db09901655699181;
|
|
|
|
- timeStamp = 1543026120;
|
|
|
|
- }
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
- //吊起微信
|
|
|
|
- // PayReq *request = [[PayReq alloc] init] ;
|
|
|
|
- // request.package = @"Sign=WXPay";
|
|
|
|
- // request.nonceStr= data[@"nonceStr"];
|
|
|
|
- // request.partnerId = data[@"partnerid"];
|
|
|
|
- // request.sign= data[@"paySign"];
|
|
|
|
- // request.timeStamp= [data[@"timeStamp"] intValue];
|
|
|
|
- // request.openID = data[@"appId"];
|
|
|
|
- // request.prepayId= data[@"prepay_id"];
|
|
|
|
- // [WXApi sendReq:request];
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
-(void)jsHideRedSpotOnMenu:(NSString*)str
|
|
-(void)jsHideRedSpotOnMenu:(NSString*)str
|
|
@@ -1024,6 +1029,73 @@ NSString *const AesKey_3 = @"mGlAgnIBB8bx2nch";
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+#pragma mark 支付相关
|
|
|
|
+
|
|
|
|
+-(void)jsWxPay:(NSString *)jsonString
|
|
|
|
+{
|
|
|
|
+ /*
|
|
|
|
+ {"Prepayid":"wx31091637721432c596f288011332866700","PackageStr":"Sign=WXPay","Noncestr":"3672278166105353OSDXVDiJqjdsBQzz","Timestamp":"1564535754","Sign":"C1A3579B264B8BC984576DFF083AE7C8"}
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ // NSDictionary *Object=[NSJSONSerialization JSONObjectWithData:dict options:NSJSONReadingMutableLeaves error:nil];
|
|
|
|
+
|
|
|
|
+ NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
|
|
|
|
+
|
|
|
|
+ NSError *err;
|
|
|
|
+
|
|
|
|
+ NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData
|
|
|
|
+
|
|
|
|
+ options:NSJSONReadingMutableContainers
|
|
|
|
+
|
|
|
|
+ error:&err];
|
|
|
|
+
|
|
|
|
+ NSLog(@"%@",dic);
|
|
|
|
+
|
|
|
|
+ if(err) {
|
|
|
|
+
|
|
|
|
+ NSLog(@"json解析失败:%@",err);
|
|
|
|
+
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //吊起微信
|
|
|
|
+ PayReq *request = [[PayReq alloc] init] ;
|
|
|
|
+ request.openID = dic[@"Appid"];
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ request.partnerId = dic[@"Partnerid"];
|
|
|
|
+ request.prepayId= dic[@"Prepayid"];
|
|
|
|
+ request.package = @"Sign=WXPay";
|
|
|
|
+ request.nonceStr= dic[@"Noncestr"];
|
|
|
|
+ request.timeStamp= [dic[@"Timestamp"] intValue];
|
|
|
|
+ request.sign= dic[@"Sign"];
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ kMainQueue(^{
|
|
|
|
+ [WXApi sendReq:request];
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+-(void)jsAliPay:(NSString*)str
|
|
|
|
+{
|
|
|
|
+ kMainQueue(^{
|
|
|
|
+ [[AlipaySDK defaultService] payOrder:str fromScheme:@"jianyuiosapp" callback:nil];
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
/*
|
|
/*
|
|
#pragma mark - Navigation
|
|
#pragma mark - Navigation
|
|
|
|
|