Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
foreign
/
customer-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
77f708a6
authored
Nov 24, 2021
by
杨铁龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
indexdb orgid 使用传入的orgid
parent
d940313d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
12 deletions
database/index.ts
xim/index.ts
database/index.ts
View file @
77f708a6
...
...
@@ -57,17 +57,17 @@ class ChatCacheDatabaseController {
}
resolve
();
};
r
.
onsuccess
=
function
(
e
)
{
r
.
onsuccess
=
function
(
e
)
{
that
.
db
=
(
e
.
target
as
any
).
result
;
console
.
log
(
`index database init comepleted`
);
setupDb
();
};
r
.
onupgradeneeded
=
function
(
e
)
{
r
.
onupgradeneeded
=
function
(
e
)
{
that
.
db
=
(
e
.
target
as
any
).
result
;
console
.
log
(
`upgrade database comepleted`
);
setupDb
();
};
r
.
onerror
=
function
(
e
)
{
r
.
onerror
=
function
(
e
)
{
console
.
log
(
`index database init failed,
${
e
}
`
);
};
}
else
{
...
...
@@ -94,17 +94,17 @@ class ChatCacheDatabaseController {
}
setTimeout
(()
=>
resolve
(),
200
);
};
r
.
onsuccess
=
function
(
e
)
{
r
.
onsuccess
=
function
(
e
)
{
const
db
=
(
e
.
target
as
any
).
result
;
that
.
messageDatabases
.
set
(
k
,
db
);
setupDb
();
};
r
.
onupgradeneeded
=
function
(
e
)
{
r
.
onupgradeneeded
=
function
(
e
)
{
const
db
=
(
e
.
target
as
any
).
result
;
that
.
messageDatabases
.
set
(
k
,
db
);
setupDb
();
};
r
.
onerror
=
function
(
e
)
{
r
.
onerror
=
function
(
e
)
{
console
.
log
(
`chat message index database init failed,
${
e
}
`
);
...
...
xim/index.ts
View file @
77f708a6
...
...
@@ -59,7 +59,7 @@ class Chat implements ChatMessageController {
option
.
avatar
!==
undefined
&&
(
this
.
defaultAvatar
=
option
.
avatar
);
await
this
.
setupIndexDb
();
await
this
.
setupIndexDb
(
option
.
orgId
()
);
this
.
token
=
async
()
=>
option
.
sdk
().
global
.
jwtToken
;
tokenManager
.
save
(
this
.
token
);
...
...
@@ -83,12 +83,11 @@ class Chat implements ChatMessageController {
});
}
private
setupIndexDb
()
{
private
setupIndexDb
(
orgId
:
number
|
string
)
{
if
(
this
.
_sdk
)
{
const
s
=
this
.
_sdk
();
return
dbController
.
setup
(
s
.
global
.
uid
+
"-"
+
(
s
.
global
.
initData
.
orgId
||
0
)
);
const
key
=
`
${
s
.
global
.
uid
}
-
${
orgId
||
0
}
`
return
dbController
.
setup
(
key
);
}
return
Promise
.
reject
(
new
Error
(
"Sdk is not defined"
));
}
...
...
@@ -96,7 +95,7 @@ class Chat implements ChatMessageController {
public
resetup
(
org
:
()
=>
string
|
number
)
{
this
.
_orgId
=
org
;
xim
.
onConnected
();
return
this
.
setupIndexDb
();
return
this
.
setupIndexDb
(
org
()
);
}
public
unSetup
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment