From ac8d89454b656819dc389e441f1ef08ae651e8b9 Mon Sep 17 00:00:00 2001 From: satori Date: Mon, 16 Dec 2024 09:28:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=A2=91=E7=8E=87=E4=B8=BA10?= =?UTF-8?q?=E5=88=86=E9=92=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.js | 2 +- update.js | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/main.js b/main.js index e932df9..955c82f 100644 --- a/main.js +++ b/main.js @@ -87,7 +87,7 @@ export default function () { } catch(err) { console.error(err) } - await new Promise(resolve => setTimeout(resolve, 10 * 1000)) + await new Promise(resolve => setTimeout(resolve, 10 * 60 * 1000)) } } diff --git a/update.js b/update.js index 0c8263e..5507420 100644 --- a/update.js +++ b/update.js @@ -110,9 +110,7 @@ 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 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.query(`UPDATE ${table} t LEFT JOIN temp_updates tu ON t.id = tu.id SET t.${rank} = IFNULL(tu.rank, 0)`) await conn.end() console.log('更新完成') }