From a01b306b0126dc45b698a909ac6c488c2e60ff45 Mon Sep 17 00:00:00 2001 From: Derek Date: Sun, 27 May 2018 02:11:47 +0800 Subject: [PATCH] feat(jike user): add question type for jike user (#210) --- routes/jike/user.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/routes/jike/user.js b/routes/jike/user.js index 1a3f9d191..377f5020c 100644 --- a/routes/jike/user.js +++ b/routes/jike/user.js @@ -31,6 +31,7 @@ module.exports = async (ctx) => { ORIGINAL_POST: '发布', REPOST: '转发', ANSWER: '回答', + QUESTION: '提问', }; const linkMap = { @@ -38,6 +39,7 @@ module.exports = async (ctx) => { ORIGINAL_POST: `https://web.okjike.com/post-detail/${item.id}/originalPost`, REPOST: `https://web.okjike.com/post-detail/${item.id}/repost`, ANSWER: `https://m.okjike.com/answers/${item.id}`, + QUESTION: `https://m.okjike.com/questions/${item.id}`, }; let linkTemplate = ''; @@ -51,7 +53,7 @@ module.exports = async (ctx) => { imgTemplate += `
`; }); - let content = item.content || (item.linkInfo && item.linkInfo.title) || (item.question && item.question.title) || ''; + let content = item.content || (item.linkInfo && item.linkInfo.title) || (item.question && item.question.title) || item.title || ''; let shortenTitle = '一条动态'; if (content) { @@ -70,9 +72,7 @@ module.exports = async (ctx) => { const repostContent = `转发 ${screenNameTemplate}: ${item.target.content}${repostImgTemplate}`; content = `${content}${repostContent}`.replace(/\n|\r/g, '
'); - } - - if (item.type === 'ANSWER') { + } else if (item.type === 'ANSWER') { let answerTextTemplate = ''; let answerImgTemplate = ''; let answerImgKeys = []; @@ -95,6 +95,8 @@ module.exports = async (ctx) => { } const answerContent = `回答: ${answerTextTemplate}${answerImgTemplate}`; content = `${content}${answerContent}`.replace(/\n|\r/g, '
'); + } else if (item.type === 'QUESTION') { + content = `在主题 ${item.topic.content} 提出了一个问题:

${content}`; } return {