From a51818759c53c51ac9e2f99e7aad7870369c2998 Mon Sep 17 00:00:00 2001 From: satori Date: Mon, 16 Dec 2024 10:09:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E4=BB=8A=E6=97=A5=E6=B5=8F=E8=A7=88?= =?UTF-8?q?=E6=95=B0=E5=B9=B6=E5=85=A5=E6=80=BB=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main.js b/main.js index a6c71ea..658815b 100644 --- a/main.js +++ b/main.js @@ -66,6 +66,16 @@ const 存档 = async (message = '正在存档...') => { if (正在存档) return 正在存档 = true console.log(message) + + // 将今日浏览数并入总数 + const all = { 文章, 作品, 游戏, 截图, 收藏, 综合 } + for (const item of all) { + item.浏览数.日.forEach((value, key) => { + item.浏览数.总.set(key, (item.浏览数.总.get(key) || 0) + value) + }) + } + + // 数据写入日志 await fs.promises.writeFile(`./data/${当前日期}.json`, JSON.stringify({ 文章: Object.fromEntries(文章.浏览数.日), 截图: Object.fromEntries(截图.浏览数.日),