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
0f48ef0a
authored
Jan 18, 2022
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
自动校准消息
parent
1d90677b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
store/index.ts
store/index.ts
View file @
0f48ef0a
...
@@ -392,6 +392,26 @@ export default {
...
@@ -392,6 +392,26 @@ export default {
loadingChatList
=
true
;
loadingChatList
=
true
;
const
checkCurrentChat
=
(
items
:
ChatType
[])
=>
{
const
chatId
=
state
[
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
];
if
(
chatId
)
{
const
t
=
items
.
find
((
i
)
=>
i
.
chat_id
===
chatId
);
if
(
t
)
{
const
msgs
=
state
[
ChatStore
.
STATE_CHAT_MSG_HISTORY
];
if
(
msgs
)
{
const
last
=
msgs
[
msgs
.
length
-
1
];
// 如果会话列表里面返回的最后消息时间或id大于当前会话缓存的信息,获取最新消息
if
(
t
.
last_msg_ts
>
last
.
ts
||
t
.
msg_id
>
last
.
id
)
{
dispatch
(
ChatStore
.
ACTION_GET_CHAT_MESSAGES_AFTER_SPECIFIC_ID
,
last
.
id
);
}
}
}
}
};
const
execute
=
()
=>
const
execute
=
()
=>
new
Promise
<
ChatType
[]
>
((
resolve
,
reject
)
=>
{
new
Promise
<
ChatType
[]
>
((
resolve
,
reject
)
=>
{
Chat
.
onReady
(()
=>
{
Chat
.
onReady
(()
=>
{
...
@@ -414,6 +434,7 @@ export default {
...
@@ -414,6 +434,7 @@ export default {
dispatch
(
dispatch
(
ChatStore
.
ACTION_REBUILD_UNREAD_MESSAGE_COUNT
ChatStore
.
ACTION_REBUILD_UNREAD_MESSAGE_COUNT
);
);
checkCurrentChat
(
items
);
resolve
(
items
);
resolve
(
items
);
})
})
.
catch
(
reject
);
.
catch
(
reject
);
...
...
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