From fb92ab2a6fef994e735943b0941b159a0fbed248 Mon Sep 17 00:00:00 2001 From: Ethan H Date: Fri, 29 Mar 2019 16:32:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0mobdata=E5=88=86=E6=9E=90?= =?UTF-8?q?=E6=8A=A5=E5=91=8A=20(#1847)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/other.md | 4 ++++ lib/router.js | 3 +++ lib/routes/mobdata/report.js | 30 ++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 lib/routes/mobdata/report.js diff --git a/docs/other.md b/docs/other.md index e245a8881..ecaf870c8 100644 --- a/docs/other.md +++ b/docs/other.md @@ -462,6 +462,10 @@ type 为 all 时,category 参数不支持 cost 和 free +### MobData + + + ### 腾讯谷雨 diff --git a/lib/router.js b/lib/router.js index 478c51709..01fcec921 100755 --- a/lib/router.js +++ b/lib/router.js @@ -1217,6 +1217,9 @@ router.get('/infoq/topic/:id', require('./routes/infoq/topic')); // 艾瑞 router.get('/iresearch/report', require('./routes/iresearch/report')); +// MobData +router.get('/mobdata/report', require('./routes/mobdata/report')); + // 谷雨 router.get('/tencent/guyu/channel/:name', require('./routes/tencent/guyu/channel')); diff --git a/lib/routes/mobdata/report.js b/lib/routes/mobdata/report.js new file mode 100644 index 000000000..2ae90b34a --- /dev/null +++ b/lib/routes/mobdata/report.js @@ -0,0 +1,30 @@ +const axios = require('../../utils/axios'); +const date = require('../../utils/date'); + +module.exports = async (ctx) => { + const apiUrl = 'http://admin.mob.com/api/mobdata/report/list'; + const pageUrl = 'http://mobdata.mob.com/mobdata/report'; + + const resp = await axios({ + method: 'post', + url: apiUrl, + headers: { + Referer: pageUrl, + 'Content-Type': 'application/json', + }, + }); + + const list = resp.data.list; + const items = list.map((item) => ({ + title: item.title, + description: `${item.desc}
查看报告`, + pubDate: date(item.created_at), + link: item.report_path, + })); + ctx.state.data = { + title: 'MobData分析报告', + link: pageUrl, + description: 'MobData分析报告', + item: items, + }; +};