更新指标到数据库
This commit is contained in:
6
main.js
6
main.js
@@ -38,7 +38,7 @@ const archive = async (message = '正在存档...') => {
|
||||
// 主函数
|
||||
export default function () {
|
||||
if (fs.existsSync(`./data/${currentDate}.json`)) {
|
||||
console.log(currentDate, '启动时加载数据...')
|
||||
console.log(currentDate, '启动时加载当日数据...')
|
||||
const file = fs.readFileSync(`./data/${currentDate}.json`, 'utf8')
|
||||
if (file) {
|
||||
const data = JSON.parse(file)
|
||||
@@ -52,7 +52,9 @@ export default function () {
|
||||
|
||||
setInterval(() => {
|
||||
archive('每10分钟自动存档...')
|
||||
update('day_rank', Object.entries(Object.fromEntries(screenshots))) // 更新数据库中 day_rank 字段
|
||||
update('web_images', 'day_rank', Object.entries(Object.fromEntries(screenshots))),
|
||||
update('web_article', 'day_rank', Object.entries(Object.fromEntries(articles))),
|
||||
update('web_member_explorer', 'day_rank', Object.entries(Object.fromEntries(collections)))
|
||||
}, 600000)
|
||||
|
||||
// 实时读取日志文件
|
||||
|
Reference in New Issue
Block a user