From a9f3e7fc54ba0b8e608181dca80c1f0a4560e00d Mon Sep 17 00:00:00 2001 From: po-lan <42771836+po-lan@users.noreply.github.com> Date: Fri, 5 Jul 2024 12:12:40 +0800 Subject: [PATCH] Update db.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 通过读取缓存修复刚说话缺无法获取发言时间的问题 --- src/common/utils/db.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/common/utils/db.ts b/src/common/utils/db.ts index 96bd7a84..e7860150 100644 --- a/src/common/utils/db.ts +++ b/src/common/utils/db.ts @@ -408,10 +408,12 @@ class DBUtil extends DBUtilBase { logDebug('读取发言时间', groupId); return new Promise((resolve, reject) => { this.db!.all(`SELECT * FROM "${groupId}" `, (err, rows: IRember[]) => { + const cache = this.LURCache.get(groupId).map(e=>({user_id:e.userId, last_sent_time:e.value})); if (err) { logError('查询发言时间失败', groupId); - return resolve([]); + return resolve(cache.map(e=>({...e, join_time:0}))); } + Object.assign(rows, cache) logDebug('查询发言时间成功', groupId, rows); resolve(rows); });