更新频率为10分钟

This commit is contained in:
2024-12-16 09:28:05 +08:00
parent 586fb257bd
commit ac8d89454b
2 changed files with 2 additions and 4 deletions

View File

@@ -87,7 +87,7 @@ export default function () {
} catch(err) { } catch(err) {
console.error(err) console.error(err)
} }
await new Promise(resolve => setTimeout(resolve, 10 * 1000)) await new Promise(resolve => setTimeout(resolve, 10 * 60 * 1000))
} }
} }

View File

@@ -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") await conn.query("UPDATE temp_updates SET rank = collect_count * 35 + praise_count * 20 + comment_count * 20 + views_count * 25")
console.log('更新数据从临时表转入生产库', table) 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() await conn.end()
console.log('更新完成') console.log('更新完成')
} }