Commit e5a7e365 by Sixong.Zhu

update

parent 2aff577f
Showing with 18 additions and 8 deletions
......@@ -21,6 +21,7 @@ class Chat {
private product = CustomerServiceProduct.Default;
private eventHub: Vue | null = null;
private keywords: string[] = [];
private ws = "";
private userMapping: { [key: string]: { name: string; avatar: string } } =
{};
......@@ -48,12 +49,7 @@ class Chat {
};
}
dbController.setup(
this._sdk().global.uid +
"-" +
(this._sdk().global.initData.orgId || 0)
);
this.setupIndexDb();
this.token = async () => option.sdk().global.jwtToken;
tokenManager.save(this.token);
......@@ -67,7 +63,21 @@ class Chat {
// this.keywords = ["社保"];
return this.initChatSdk(option.webSocketUri);
return this.initChatSdk((this.ws = option.webSocketUri));
}
private setupIndexDb() {
return dbController.setup(
this._sdk().global.uid +
"-" +
(this._sdk().global.initData.orgId || 0)
);
}
public resetup(org: () => string | number) {
this._orgId = org;
xim.onConnected();
return this.setupIndexDb();
}
public unSetup() {
......
......@@ -334,7 +334,7 @@ export class Xim {
return [args.slice(0, -1).join("."), listener];
}
private onConnected() {
public onConnected() {
if (this.client == null) return;
// 连接成功后,需要调用pubUserInfo, 否则服务端会认为此连接无效
this.client.pubUserInfo(JSON.stringify({ org_id: chat.getOrgId() }));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment