fix 修复多余调用代码导致的报错

This commit is contained in:
little-snow-fox 2020-06-19 14:39:53 +08:00
parent 23fb934cf0
commit c3209151a1
3 changed files with 30 additions and 29 deletions

View File

@ -498,26 +498,26 @@ RCT_EXPORT_METHOD(launchMiniProgram:(NSDictionary *)data
// callback(@[success ? [NSNull null] : INVOKE_FAILED]); // callback(@[success ? [NSNull null] : INVOKE_FAILED]);
} }
RCT_EXPORT_METHOD(pay:(NSDictionary *)data //RCT_EXPORT_METHOD(pay:(NSDictionary *)data
:(RCTResponseSenderBlock)callback) // :(RCTResponseSenderBlock)callback)
{ //{
PayReq* req = [PayReq new]; // PayReq* req = [PayReq new];
req.partnerId = data[@"partnerId"]; // req.partnerId = data[@"partnerId"];
req.prepayId = data[@"prepayId"]; // req.prepayId = data[@"prepayId"];
req.nonceStr = data[@"nonceStr"]; // req.nonceStr = data[@"nonceStr"];
req.timeStamp = [data[@"timeStamp"] unsignedIntValue]; // req.timeStamp = [data[@"timeStamp"] unsignedIntValue];
req.package = data[@"package"]; // req.package = data[@"package"];
req.sign = data[@"sign"]; // req.sign = data[@"sign"];
void ( ^ completion )( BOOL ); // void ( ^ completion )( BOOL );
completion = ^( BOOL success ) // completion = ^( BOOL success )
{ // {
callback(@[success ? [NSNull null] : INVOKE_FAILED]);
return;
};
[WXApi sendReq:req completion:completion];
// BOOL success = [WXApi sendReq:req];
// callback(@[success ? [NSNull null] : INVOKE_FAILED]); // callback(@[success ? [NSNull null] : INVOKE_FAILED]);
} // return;
// };
// [WXApi sendReq:req completion:completion];
// // BOOL success = [WXApi sendReq:req];
// // callback(@[success ? [NSNull null] : INVOKE_FAILED]);
//}
#pragma mark - wx callback #pragma mark - wx callback
@ -566,14 +566,14 @@ RCT_EXPORT_METHOD(pay:(NSDictionary *)data
else { else {
[self.bridge.eventDispatcher sendDeviceEventWithName:RCTWXEventName body:body]; [self.bridge.eventDispatcher sendDeviceEventWithName:RCTWXEventName body:body];
} }
} else if ([resp isKindOfClass:[PayResp class]]) { // } else if ([resp isKindOfClass:[PayResp class]]) {
PayResp *r = (PayResp *)resp; // PayResp *r = (PayResp *)resp;
NSMutableDictionary *body = @{@"errCode":@(r.errCode)}.mutableCopy; // NSMutableDictionary *body = @{@"errCode":@(r.errCode)}.mutableCopy;
body[@"errStr"] = r.errStr; // body[@"errStr"] = r.errStr;
body[@"type"] = @(r.type); // body[@"type"] = @(r.type);
body[@"returnKey"] =r.returnKey; // body[@"returnKey"] =r.returnKey;
body[@"type"] = @"PayReq.Resp"; // body[@"type"] = @"PayReq.Resp";
[self.bridge.eventDispatcher sendDeviceEventWithName:RCTWXEventName body:body]; // [self.bridge.eventDispatcher sendDeviceEventWithName:RCTWXEventName body:body];
} else if ([resp isKindOfClass:[WXLaunchMiniProgramResp class]]){ } else if ([resp isKindOfClass:[WXLaunchMiniProgramResp class]]){
WXLaunchMiniProgramResp *r = (WXLaunchMiniProgramResp *)resp; WXLaunchMiniProgramResp *r = (WXLaunchMiniProgramResp *)resp;
NSMutableDictionary *body = @{@"errCode":@(r.errCode)}.mutableCopy; NSMutableDictionary *body = @{@"errCode":@(r.errCode)}.mutableCopy;

View File

@ -1,6 +1,6 @@
{ {
"name": "react-native-wechat-lib", "name": "react-native-wechat-lib",
"version": "1.1.18", "version": "1.1.19-notpay",
"description": "react-native library for wechat app. 支持分享和拉起小程序。", "description": "react-native library for wechat app. 支持分享和拉起小程序。",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

1
react-native-wechat-lib Symbolic link
View File

@ -0,0 +1 @@
react-native-wechat-lib