From 94de8e020fc08dab7d2b87099ea74e7cc46b3570 Mon Sep 17 00:00:00 2001
From: umm233 <32997707+umm233@users.noreply.github.com>
Date: Tue, 10 Mar 2020 18:39:06 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20wolley.io=20rss=20=E4=B8=AD=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A0=E6=96=87=E7=AB=A0=E5=88=86=E4=BA=AB=E7=90=86=E7=94=B1?=
=?UTF-8?q?=20(#4200)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/routes/wolley/index.js | 31 +++++++++++++++++++++++++------
1 file changed, 25 insertions(+), 6 deletions(-)
diff --git a/lib/routes/wolley/index.js b/lib/routes/wolley/index.js
index 54ece097b..dd47fb413 100644
--- a/lib/routes/wolley/index.js
+++ b/lib/routes/wolley/index.js
@@ -18,11 +18,30 @@ module.exports = async (ctx) => {
link,
description: '',
- item: data.map((item) => ({
- title: item.title,
- description: `via @${item.user.handler}
Comments`,
- pubDate: item.createdAt,
- link: item.url,
- })),
+ item: data.map((item) => {
+ let item_title = item.title;
+ let item_url = item.url;
+ let item_content = '';
+
+ if (item.content !== '') {
+ item_content = `分享理由: ${item.content}
`;
+ }
+
+ // 当 item.url 不存在时,设置 url 为 wolley 的文章地址
+ if (item.url === undefined) {
+ item_url = `https://wolley.io/item/${item.id}`;
+ }
+ if (item.type === 'question') {
+ item_title = `提问: ${item_title}`;
+ item_content = `提问内容: ${item.content}
`;
+ }
+
+ return {
+ title: item_title,
+ description: `${item_content}via @${item.user.handler}
Comments`,
+ pubDate: item.createdAt,
+ link: item_url,
+ };
+ }),
};
};