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 {
...
@@ -57,17 +57,17 @@ class ChatCacheDatabaseController {
}
}
resolve
();
resolve
();
};
};
r
.
onsuccess
=
function
(
e
)
{
r
.
onsuccess
=
function
(
e
)
{
that
.
db
=
(
e
.
target
as
any
).
result
;
that
.
db
=
(
e
.
target
as
any
).
result
;
console
.
log
(
`index database init comepleted`
);
console
.
log
(
`index database init comepleted`
);
setupDb
();
setupDb
();
};
};
r
.
onupgradeneeded
=
function
(
e
)
{
r
.
onupgradeneeded
=
function
(
e
)
{
that
.
db
=
(
e
.
target
as
any
).
result
;
that
.
db
=
(
e
.
target
as
any
).
result
;
console
.
log
(
`upgrade database comepleted`
);
console
.
log
(
`upgrade database comepleted`
);
setupDb
();
setupDb
();
};
};
r
.
onerror
=
function
(
e
)
{
r
.
onerror
=
function
(
e
)
{
console
.
log
(
`index database init failed,
${
e
}
`
);
console
.
log
(
`index database init failed,
${
e
}
`
);
};
};
}
else
{
}
else
{
...
@@ -94,17 +94,17 @@ class ChatCacheDatabaseController {
...
@@ -94,17 +94,17 @@ class ChatCacheDatabaseController {
}
}
setTimeout
(()
=>
resolve
(),
200
);
setTimeout
(()
=>
resolve
(),
200
);
};
};
r
.
onsuccess
=
function
(
e
)
{
r
.
onsuccess
=
function
(
e
)
{
const
db
=
(
e
.
target
as
any
).
result
;
const
db
=
(
e
.
target
as
any
).
result
;
that
.
messageDatabases
.
set
(
k
,
db
);
that
.
messageDatabases
.
set
(
k
,
db
);
setupDb
();
setupDb
();
};
};
r
.
onupgradeneeded
=
function
(
e
)
{
r
.
onupgradeneeded
=
function
(
e
)
{
const
db
=
(
e
.
target
as
any
).
result
;
const
db
=
(
e
.
target
as
any
).
result
;
that
.
messageDatabases
.
set
(
k
,
db
);
that
.
messageDatabases
.
set
(
k
,
db
);
setupDb
();
setupDb
();
};
};
r
.
onerror
=
function
(
e
)
{
r
.
onerror
=
function
(
e
)
{
console
.
log
(
console
.
log
(
`chat message index database init failed,
${
e
}
`
`chat message index database init failed,
${
e
}
`
);
);
...
...
xim/index.ts
View file @
77f708a6
...
@@ -59,7 +59,7 @@ class Chat implements ChatMessageController {
...
@@ -59,7 +59,7 @@ class Chat implements ChatMessageController {
option
.
avatar
!==
undefined
&&
option
.
avatar
!==
undefined
&&
(
this
.
defaultAvatar
=
option
.
avatar
);
(
this
.
defaultAvatar
=
option
.
avatar
);
await
this
.
setupIndexDb
();
await
this
.
setupIndexDb
(
option
.
orgId
()
);
this
.
token
=
async
()
=>
option
.
sdk
().
global
.
jwtToken
;
this
.
token
=
async
()
=>
option
.
sdk
().
global
.
jwtToken
;
tokenManager
.
save
(
this
.
token
);
tokenManager
.
save
(
this
.
token
);
...
@@ -83,12 +83,11 @@ class Chat implements ChatMessageController {
...
@@ -83,12 +83,11 @@ class Chat implements ChatMessageController {
});
});
}
}
private
setupIndexDb
()
{
private
setupIndexDb
(
orgId
:
number
|
string
)
{
if
(
this
.
_sdk
)
{
if
(
this
.
_sdk
)
{
const
s
=
this
.
_sdk
();
const
s
=
this
.
_sdk
();
return
dbController
.
setup
(
const
key
=
`
${
s
.
global
.
uid
}
-
${
orgId
||
0
}
`
s
.
global
.
uid
+
"-"
+
(
s
.
global
.
initData
.
orgId
||
0
)
return
dbController
.
setup
(
key
);
);
}
}
return
Promise
.
reject
(
new
Error
(
"Sdk is not defined"
));
return
Promise
.
reject
(
new
Error
(
"Sdk is not defined"
));
}
}
...
@@ -96,7 +95,7 @@ class Chat implements ChatMessageController {
...
@@ -96,7 +95,7 @@ class Chat implements ChatMessageController {
public
resetup
(
org
:
()
=>
string
|
number
)
{
public
resetup
(
org
:
()
=>
string
|
number
)
{
this
.
_orgId
=
org
;
this
.
_orgId
=
org
;
xim
.
onConnected
();
xim
.
onConnected
();
return
this
.
setupIndexDb
();
return
this
.
setupIndexDb
(
org
()
);
}
}
public
unSetup
()
{
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