修复发布时间的bug (#651)

This commit is contained in:
Shao ye 2018-09-07 19:02:48 +08:00 committed by DIYgod
parent 202d80cca6
commit c774197e57
1 changed files with 7 additions and 3 deletions

View File

@ -36,7 +36,11 @@ module.exports = async (ctx) => {
const dateList = $('.content tr')
.find('div')
.slice(0, 10)
.map((i, e) => $(e).text())
.map((i, e) =>
$(e)
.text()
.replace('发布时间:', '')
)
.get();
const out = await Promise.all(
@ -61,7 +65,7 @@ module.exports = async (ctx) => {
$('.Article_PublishDate')
.text()
.replace('发布时间:', '')
),
).toUTCString(),
};
ctx.cache.set(itemUrl, JSON.stringify(single), 24 * 60 * 60);
return Promise.resolve(single);
@ -70,7 +74,7 @@ module.exports = async (ctx) => {
title: titleList[index],
link: itemUrl,
description: '该通知为文件,请点击原文链接↑下载',
pubDate: dateList,
pubDate: new Date(dateList[index]).toUTCString(),
};
return Promise.resolve(single);
}