From 586fb257bd38f68c6b458032c53e6acd277409d3 Mon Sep 17 00:00:00 2001 From: satori Date: Mon, 16 Dec 2024 09:13:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E4=BD=BF=E7=94=A8=E5=B7=A6=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E4=BB=A5=E4=BC=98=E5=8C=96=E6=9B=B4=E6=96=B0=E9=80=9F?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- update.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/update.js b/update.js index 5507420..0c8263e 100644 --- a/update.js +++ b/update.js @@ -110,7 +110,9 @@ export async function update(table, rank, views) { await conn.query("UPDATE temp_updates SET rank = collect_count * 35 + praise_count * 20 + comment_count * 20 + views_count * 25") console.log('更新数据从临时表转入生产库', table) - await conn.query(`UPDATE ${table} t LEFT JOIN temp_updates tu ON t.id = tu.id SET t.${rank} = IFNULL(tu.rank, 0)`) + //await conn.query(`UPDATE ${table} t LEFT JOIN temp_updates tu ON t.id = tu.id SET t.${rank} = IFNULL(tu.rank, 0)`) + await conn.query(`UPDATE ${table} t SET t.${rank} = 0`) + await conn.query(`UPDATE ${table} t JOIN temp_updates tu ON t.id = tu.id SET t.${rank} = IFNULL(tu.rank, 0)`) await conn.end() console.log('更新完成') }