close #1499
This commit is contained in:
Henry Wang
2019-01-31 03:12:22 +00:00
committed by DIYgod
parent aee658b121
commit 70e13884da
2 changed files with 5 additions and 4 deletions

View File

@@ -40,7 +40,7 @@ module.exports = async (ctx) => {
const regResult = /https:\/\/www.okjike.com\/medium\/[a-zA-Z0-9]*/.exec(item.description);
if (regResult) {
const newsUrl = regResult[0];
const cache = ctx.cache.get(newsUrl);
const cache = await ctx.cache.get(newsUrl);
if (cache) {
item.description = cache;
} else {
@@ -55,13 +55,14 @@ module.exports = async (ctx) => {
}
if (description) {
item.description = description;
ctx.cache.set(newsUrl, description);
await ctx.cache.set(newsUrl, description, 24 * 60 * 60);
}
}
}
item.title = `${topic.content} ${dayjs(new Date(one.pubDate)).format('MM月DD日')}`;
return item;
});
ctx.state.data.item = await Promise.all(promises);
}
};