fix: add the corpId param

This commit is contained in:
BambooSword 2023-06-27 21:40:06 +08:00
parent d3292dd064
commit 9ba05c11e5
3 changed files with 9 additions and 5 deletions

View File

@ -674,7 +674,7 @@ public class WeChatLibModule extends ReactContextBaseJavaModule implements IWXAP
} }
@ReactMethod @ReactMethod
public void openCustomerServiceChat(String kfUrl, Callback callback) { public void openCustomerServiceChat(String corpId, String kfUrl, Callback callback) {
if (api == null) { if (api == null) {
callback.invoke(NOT_REGISTERED); callback.invoke(NOT_REGISTERED);
return; return;
@ -682,7 +682,7 @@ public class WeChatLibModule extends ReactContextBaseJavaModule implements IWXAP
// open customer service logic // open customer service logic
WXOpenCustomerServiceChat.Req req = new WXOpenCustomerServiceChat.Req(); WXOpenCustomerServiceChat.Req req = new WXOpenCustomerServiceChat.Req();
req.corpId = this.appId; req.corpId = corpId;
req.url = kfUrl; req.url = kfUrl;
callback.invoke(null, api.sendReq(req)); callback.invoke(null, api.sendReq(req));
} }

View File

@ -569,11 +569,12 @@ RCT_EXPORT_METHOD(pay:(NSDictionary *)data
} }
// 跳转微信客服 // 跳转微信客服
RCT_EXPORT_METHOD(openCustomerServiceChat:(NSString *)kfUrl RCT_EXPORT_METHOD(openCustomerServiceChat:(NSString *)corpId
:(NSString *)kfUrl
:(RCTResponseSenderBlock)callback) :(RCTResponseSenderBlock)callback)
{ {
WXOpenCustomerServiceReq *req = [[WXOpenCustomerServiceReq alloc] init]; WXOpenCustomerServiceReq *req = [[WXOpenCustomerServiceReq alloc] init];
req.corpid = self.appId; //企业ID req.corpid = corpId; //企业ID
req.url = kfUrl; //客服URL req.url = kfUrl; //客服URL
[WXApi sendReq:req completion:nil]; [WXApi sendReq:req completion:nil];
} }

5
src/index.d.ts vendored
View File

@ -13,7 +13,10 @@ declare module 'react-native-wechat-lib' {
appId: string, appId: string,
universalLink?: string universalLink?: string
): Promise<boolean>; ): Promise<boolean>;
export function openCustomerServiceChat(kfUrl: string): Promise<string>; export function openCustomerServiceChat(
corpId: string,
kfUrl: string
): Promise<string>;
export function isWXAppInstalled(): Promise<boolean>; export function isWXAppInstalled(): Promise<boolean>;
export function isWXAppSupportApi(): Promise<boolean>; export function isWXAppSupportApi(): Promise<boolean>;
export function getApiVersion(): Promise<string>; export function getApiVersion(): Promise<string>;