From 4d0f93db14d4c327ec31e91904eb6f07472c7edc Mon Sep 17 00:00:00 2001 From: hoilc Date: Sat, 1 Feb 2020 17:16:27 +0800 Subject: [PATCH] fix: hk01 null author (#3817) --- lib/routes/hk01/channel.js | 2 +- lib/routes/hk01/hot.js | 2 +- lib/routes/hk01/issue.js | 2 +- lib/routes/hk01/tag.js | 2 +- lib/routes/hk01/zone.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/routes/hk01/channel.js b/lib/routes/hk01/channel.js index 253e10c2d4..af455d42b4 100644 --- a/lib/routes/hk01/channel.js +++ b/lib/routes/hk01/channel.js @@ -13,7 +13,7 @@ module.exports = async (ctx) => { link: data.category.publishUrl, item: list.map((item) => ({ title: item.data.title, - author: item.data.authors.map((e) => e.publishName).join(', '), + author: item.data.authors && item.data.authors.map((e) => e.publishName).join(', '), description: `

${item.data.description}…

`, pubDate: new Date(item.data.lastModifyTime * 1000), link: item.data.canonicalUrl, diff --git a/lib/routes/hk01/hot.js b/lib/routes/hk01/hot.js index 9449667710..b991a7ff0f 100644 --- a/lib/routes/hk01/hot.js +++ b/lib/routes/hk01/hot.js @@ -11,7 +11,7 @@ module.exports = async (ctx) => { link: data.meta.canonicalUrl, item: list.map((item) => ({ title: item.data.title, - author: item.data.authors.map((e) => e.publishName).join(', '), + author: item.data.authors && item.data.authors.map((e) => e.publishName).join(', '), description: `

${item.data.description}

`, pubDate: new Date(item.data.lastModifyTime * 1000), link: item.data.canonicalUrl, diff --git a/lib/routes/hk01/issue.js b/lib/routes/hk01/issue.js index 1f079faf36..8a4eb30272 100644 --- a/lib/routes/hk01/issue.js +++ b/lib/routes/hk01/issue.js @@ -13,7 +13,7 @@ module.exports = async (ctx) => { link: data.issue.publishUrl, item: list.map((item) => ({ title: item.data.title, - author: item.data.authors.map((e) => e.publishName).join(', '), + author: item.data.authors && item.data.authors.map((e) => e.publishName).join(', '), description: `

${item.data.description}…

`, pubDate: new Date(item.data.lastModifyTime * 1000), link: item.data.canonicalUrl, diff --git a/lib/routes/hk01/tag.js b/lib/routes/hk01/tag.js index 54691c952e..46186f9d8b 100644 --- a/lib/routes/hk01/tag.js +++ b/lib/routes/hk01/tag.js @@ -13,7 +13,7 @@ module.exports = async (ctx) => { link: data.tag.publishUrl, item: list.map((item) => ({ title: item.data.title, - author: item.data.authors.map((e) => e.publishName).join(', '), + author: item.data.authors && item.data.authors.map((e) => e.publishName).join(', '), description: `

${item.data.description}

`, pubDate: new Date(item.data.lastModifyTime * 1000), link: item.data.canonicalUrl, diff --git a/lib/routes/hk01/zone.js b/lib/routes/hk01/zone.js index 3131d85842..e39c165635 100644 --- a/lib/routes/hk01/zone.js +++ b/lib/routes/hk01/zone.js @@ -17,7 +17,7 @@ module.exports = async (ctx) => { let pubDate; switch (item.type) { case 1: - author = item.data.authors.map((e) => e.publishName).join(', '); + author = item.data.authors && item.data.authors.map((e) => e.publishName).join(', '); description = `

${item.data.description}

`; pubDate = new Date(item.data.lastModifyTime * 1000); break;