mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-11 18:42:54 +00:00
perf: 优化临时会话的消息推送
This commit is contained in:
parent
8aa66661ac
commit
d50c8ce691
46
resources/assets/js/store/actions.js
vendored
46
resources/assets/js/store/actions.js
vendored
@ -3792,34 +3792,34 @@ export default {
|
|||||||
break;
|
break;
|
||||||
case 'add':
|
case 'add':
|
||||||
case 'chat':
|
case 'chat':
|
||||||
|
const isChat = mode === "chat" || $A.isSubElectron;
|
||||||
if (!state.dialogMsgs.find(({id}) => id == data.id)) {
|
if (!state.dialogMsgs.find(({id}) => id == data.id)) {
|
||||||
// 新增任务消息数量
|
// 新增任务消息数量
|
||||||
dispatch("increaseTaskMsgNum", data);
|
dispatch("increaseTaskMsgNum", data);
|
||||||
// 新增回复数量
|
// 新增回复数量
|
||||||
dispatch("increaseMsgReplyNum", data);
|
dispatch("increaseMsgReplyNum", data);
|
||||||
//
|
//
|
||||||
if (mode === "chat" || $A.isSubElectron) {
|
if (!isChat) {
|
||||||
return;
|
if (data.userid !== state.userId) {
|
||||||
}
|
// 更新对话新增未读数
|
||||||
if (data.userid !== state.userId) {
|
const dialog = state.cacheDialogs.find(({id}) => id == dialog_id);
|
||||||
// 更新对话新增未读数
|
if (dialog) {
|
||||||
const dialog = state.cacheDialogs.find(({id}) => id == dialog_id);
|
const newData = {
|
||||||
if (dialog) {
|
id: dialog_id,
|
||||||
const newData = {
|
unread: dialog.unread + 1,
|
||||||
id: dialog_id,
|
mention: dialog.mention,
|
||||||
unread: dialog.unread + 1,
|
user_at: data.user_at,
|
||||||
mention: dialog.mention,
|
user_ms: data.user_ms,
|
||||||
user_at: data.user_at,
|
}
|
||||||
user_ms: data.user_ms,
|
if (data.mention) {
|
||||||
|
newData.mention++;
|
||||||
|
}
|
||||||
|
dispatch("saveDialog", newData)
|
||||||
}
|
}
|
||||||
if (data.mention) {
|
|
||||||
newData.mention++;
|
|
||||||
}
|
|
||||||
dispatch("saveDialog", newData)
|
|
||||||
}
|
}
|
||||||
}
|
if (!silence) {
|
||||||
if (!silence) {
|
Store.set('dialogMsgPush', data);
|
||||||
Store.set('dialogMsgPush', data);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const saveMsg = (data, count) => {
|
const saveMsg = (data, count) => {
|
||||||
@ -3827,12 +3827,10 @@ export default {
|
|||||||
// 更新消息列表
|
// 更新消息列表
|
||||||
dispatch("saveDialogMsg", data)
|
dispatch("saveDialogMsg", data)
|
||||||
// 更新最后消息
|
// 更新最后消息
|
||||||
dispatch("updateDialogLastMsg", data);
|
!isChat && dispatch("updateDialogLastMsg", data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setTimeout(_ => {
|
setTimeout(() => saveMsg(data, count + 1), 50);
|
||||||
saveMsg(data, ++count)
|
|
||||||
}, 20);
|
|
||||||
}
|
}
|
||||||
saveMsg(data, 0);
|
saveMsg(data, 0);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user