From f319d075e1af3562d33d0bbffb7c9cd02a64343a Mon Sep 17 00:00:00 2001 From: wushijishan <65406369+wushijishan@users.noreply.github.com> Date: Mon, 29 Jun 2020 01:12:25 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E4=BA=8C=E6=9F=84APP?= =?UTF-8?q?=E6=96=B0=E9=97=BB=20(#5081)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/game.md | 6 ++++++ lib/router.js | 3 +++ lib/routes/erbingapp/news.js | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 lib/routes/erbingapp/news.js diff --git a/docs/game.md b/docs/game.md index 70a84c48d0..70d901fc4a 100755 --- a/docs/game.md +++ b/docs/game.md @@ -461,3 +461,9 @@ Example: `https://store.steampowered.com/search/?specials=1&term=atelier` 中的 ### 游戏横幅 + +## 二柄APP + +### 新闻 + + diff --git a/lib/router.js b/lib/router.js index c7c392a81d..10b56d90c9 100644 --- a/lib/router.js +++ b/lib/router.js @@ -2896,6 +2896,9 @@ router.get('/go-weekly', require('./routes/go-weekly')); // AMD router.get('/amd/graphicsdrivers/:id/:rid?', require('./routes/amd/graphicsdrivers')); +// 二柄APP +router.get('/erbingapp/news', require('./routes/erbingapp/news')); + // 电商报 router.get('/dsb/area/:area', require('./routes/dsb/area')); diff --git a/lib/routes/erbingapp/news.js b/lib/routes/erbingapp/news.js new file mode 100644 index 0000000000..9bfea1af82 --- /dev/null +++ b/lib/routes/erbingapp/news.js @@ -0,0 +1,33 @@ +const got = require('@/utils/got'); + +module.exports = async (ctx) => { + const response = await got({ + method: 'get', + url: `https://api.diershoubing.com:5001/feed/tag/?pn=0&rn=20&tag_type=0&src=ios`, + resolveBodyOnly: true, + responseType: 'json', + }); + const data = response.feeds; + + ctx.state.data = { + title: `二柄APP`, + link: `https://www.diershoubing.com/`, + description: `二柄APP新闻`, + item: data.map((item) => { + let description = item.content; + if (item.video_img !== null) { + description += `
`; + } else { + const imgs = item.acontent.split(','); + for (let i = 0; i < imgs.length; i++) { + description += `
`; + } + } + return { + description, + link: item.share.url, + title: item.title, + }; + }), + }; +};