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
public void openCustomerServiceChat(String kfUrl, Callback callback) {
public void openCustomerServiceChat(String corpId, String kfUrl, Callback callback) {
if (api == null) {
callback.invoke(NOT_REGISTERED);
return;
@ -682,7 +682,7 @@ public class WeChatLibModule extends ReactContextBaseJavaModule implements IWXAP
// open customer service logic
WXOpenCustomerServiceChat.Req req = new WXOpenCustomerServiceChat.Req();
req.corpId = this.appId;
req.corpId = corpId;
req.url = kfUrl;
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)
{
WXOpenCustomerServiceReq *req = [[WXOpenCustomerServiceReq alloc] init];
req.corpid = self.appId; //企业ID
req.corpid = corpId; //企业ID
req.url = kfUrl; //客服URL
[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,
universalLink?: string
): 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 isWXAppSupportApi(): Promise<boolean>;
export function getApiVersion(): Promise<string>;