From c88d106a55088525ce38549f11227c76073e8c5f Mon Sep 17 00:00:00 2001 From: satori Date: Sat, 28 Dec 2024 03:49:17 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=B2=E6=AD=A2=20NULL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- update.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update.js b/update.js index f659538..a3d71fe 100644 --- a/update.js +++ b/update.js @@ -108,7 +108,7 @@ export async function update(table, rank, views) { } console.log('统计当天时间段内排行榜到临时表') - const rankUpdateResult = await conn.query("UPDATE temp_updates SET rank = collect_count * 35 + praise_count * 20 + comment_count * 20 + views_count * 25") + const rankUpdateResult = await conn.query("UPDATE temp_updates SET rank = IFNULL(collect_count, 0) * 35 + IFNULL(praise_count, 0) * 20 + IFNULL(comment_count, 0) * 20 + IFNULL(views_count, 0) * 25") console.log('排行榜更新结果:', rankUpdateResult) // 打印临时表前 10 条数据