From a641b07de1c1fbd7aa48ebcb90c14cb8c670847e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A7=89?= Date: Tue, 24 Oct 2023 06:57:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=B6=E9=97=B4=E9=97=B4=E9=9A=94=E5=B0=8F?= =?UTF-8?q?=E4=BA=8E1=E5=B0=8F=E6=97=B6=E5=85=81=E8=AE=B8=E5=90=88?= =?UTF-8?q?=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chat.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/chat.js b/src/chat.js index c2b4b17..de34354 100644 --- a/src/chat.js +++ b/src/chat.js @@ -233,9 +233,8 @@ export default class Chat { } // 如果和上一条消息是同一人, 且时间间隔小于1小时, 则向上合并 - // && new Date(time).getTime() - new Date(this.last.time).getTime() < 1000 * 60 * 60 console.log('添加一条消息', this.last, data) - if (this.last && this.last.name === data.name) { + if (this.last && this.last.name === data.name && new Date(data.time).getTime() - new Date(this.last.time).getTime() < 1000 * 60 * 60) { this.last.item.querySelector('ul').appendChild(ListItem({ textContent: data.text })) this.last = { ...data, item: this.last.item } return this.last.item