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
7ede10fd
authored
Dec 16, 2021
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
update cache
parent
0deb5a58
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
database/index.ts
database/index.ts
View file @
7ede10fd
...
@@ -313,6 +313,21 @@ class ChatCacheDatabaseController {
...
@@ -313,6 +313,21 @@ class ChatCacheDatabaseController {
});
});
}
}
public
getChatByCode
(
code
:
string
)
{
return
new
Promise
<
Chat
|
null
>
((
resolve
)
=>
{
if
(
!
this
.
db
)
{
return
resolve
(
null
);
}
const
store
=
this
.
buildStore
(
this
.
chatListKey
);
const
r
=
store
.
getAll
();
r
.
onsuccess
=
(
o
)
=>
{
const
items
=
(
o
.
target
as
any
).
result
as
Chat
[];
resolve
(
items
.
find
(
i
=>
i
.
biz_type_code
===
code
)
as
Chat
);
};
r
.
onerror
=
()
=>
resolve
(
null
);
});
}
private
buildChatMessageStore
(
chat
:
number
)
{
private
buildChatMessageStore
(
chat
:
number
)
{
const
k
=
this
.
buildChatMessageKey
(
chat
);
const
k
=
this
.
buildChatMessageKey
(
chat
);
const
db
=
this
.
messageDatabases
.
get
(
k
)
as
IDBDatabase
;
const
db
=
this
.
messageDatabases
.
get
(
k
)
as
IDBDatabase
;
...
...
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