diff --git a/docs/other.md b/docs/other.md index e245a88816..ecaf870c8a 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 478c517095..01fcec921b 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 0000000000..2ae90b34a3 --- /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, + }; +};