name
This commit is contained in:
12
main.js
12
main.js
@@ -90,6 +90,18 @@ const 存档 = async (message = '正在存档...') => {
|
|||||||
|
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
|
console.log(当前日期, '启动时加载全部数据...')
|
||||||
|
fs.readdirSync(dirPath).filter(file => file.endsWith('.json')).map(name => {
|
||||||
|
console.log('filename:', name)
|
||||||
|
const file = fs.readFileSync(`./data/${name}`, 'utf8')
|
||||||
|
if (file) {
|
||||||
|
const data = JSON.parse(file)
|
||||||
|
Object.entries(data.文章).forEach(([key, value]) => 文章.浏览数.总.set(key, value))
|
||||||
|
Object.entries(data.截图).forEach(([key, value]) => 截图.浏览数.总.set(key, value))
|
||||||
|
Object.entries(data.收藏).forEach(([key, value]) => 收藏.浏览数.总.set(key, value))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
console.log(当前日期, '启动时加载当日数据...')
|
console.log(当前日期, '启动时加载当日数据...')
|
||||||
if (fs.existsSync(`./data/${当前日期}.json`)) {
|
if (fs.existsSync(`./data/${当前日期}.json`)) {
|
||||||
const file = fs.readFileSync(`./data/${当前日期}.json`, 'utf8')
|
const file = fs.readFileSync(`./data/${当前日期}.json`, 'utf8')
|
||||||
|
Reference in New Issue
Block a user