1
0
Code Issues Pull Requests Projects Releases Wiki Activity GitHub Gitee

修改文件目录结构;小改动

This commit is contained in:
程序员小墨 2022-07-24 01:54:44 +08:00
parent a2af3be807
commit e588e463d5
2 changed files with 13 additions and 6 deletions

View File

@ -38,7 +38,10 @@ const execute_command = require('./src/execute_command');
*/
console.log("Start running ...");
// 程序主函数
/**
* 程序主函数
*/
async function start() {
// 爬取热搜数据
await get_hotband.main();
@ -55,10 +58,14 @@ if (EXECUTE_AT_STARTUP) {
// refer: https://www.npmjs.com/package/node-schedule
const scheduleJob = schedule.scheduleJob('05 * * * * *', start);
// 定时推送
/**
* 定时将热搜数据推送到 Git 仓库
*/
async function pushToGitRepo() {
let commands = [
'git status',
'git pull',
'git add .',
`git commit -m "${new Date(Date.now() + 8 * 3600 * 1000).toISOString().substring(0, 19).replace('T', ' ')} update"`,
`git push origin master`,

View File

@ -54,9 +54,9 @@ function saveJSON({ now, fileNameSuffix, object, compress = true, uncompress = t
// console.log( "year, month, day, hour, minute: " + year + ", " + month + ", " + day + ", " + hour + ", " + minute);
// 创建当前文件夹
let folder = `${DATA_FOLDER}/${year}/${month}/${day}`;
let folder = `${DATA_FOLDER}/${fileNameSuffix}/${year}/${month}/${day}`;
createFolder(folder);
let fileName = `${folder}/${year}${month}${day}_${hour}${minute}_${fileNameSuffix}`;
let fileName = `${folder}/${year}${month}${day}_${hour}${minute}`;
// 生成文件名
// '2022-07-23T10:11:38.650Z' => '20220723_1011'
@ -229,9 +229,9 @@ async function main() {
now: now,
fileNameSuffix: `simplify`,
object: data,
// compress: true,
compress: true,
// uncompress: true,
compress: false,
// compress: false,
uncompress: false,
});