Commit e5a7e365 by Sixong.Zhu

update

parent 2aff577f
Showing with 18 additions and 8 deletions
...@@ -21,6 +21,7 @@ class Chat { ...@@ -21,6 +21,7 @@ class Chat {
private product = CustomerServiceProduct.Default; private product = CustomerServiceProduct.Default;
private eventHub: Vue | null = null; private eventHub: Vue | null = null;
private keywords: string[] = []; private keywords: string[] = [];
private ws = "";
private userMapping: { [key: string]: { name: string; avatar: string } } = private userMapping: { [key: string]: { name: string; avatar: string } } =
{}; {};
...@@ -48,12 +49,7 @@ class Chat { ...@@ -48,12 +49,7 @@ class Chat {
}; };
} }
dbController.setup( this.setupIndexDb();
this._sdk().global.uid +
"-" +
(this._sdk().global.initData.orgId || 0)
);
this.token = async () => option.sdk().global.jwtToken; this.token = async () => option.sdk().global.jwtToken;
tokenManager.save(this.token); tokenManager.save(this.token);
...@@ -67,7 +63,21 @@ class Chat { ...@@ -67,7 +63,21 @@ class Chat {
// this.keywords = ["社保"]; // 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() { public unSetup() {
......
...@@ -334,7 +334,7 @@ export class Xim { ...@@ -334,7 +334,7 @@ export class Xim {
return [args.slice(0, -1).join("."), listener]; return [args.slice(0, -1).join("."), listener];
} }
private onConnected() { public onConnected() {
if (this.client == null) return; if (this.client == null) return;
// 连接成功后,需要调用pubUserInfo, 否则服务端会认为此连接无效 // 连接成功后,需要调用pubUserInfo, 否则服务端会认为此连接无效
this.client.pubUserInfo(JSON.stringify({ org_id: chat.getOrgId() })); 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