增加mobdata分析报告 (#1847)

This commit is contained in:
Ethan H
2019-03-29 16:32:51 +08:00
committed by DIYgod
parent fb92f06190
commit fb92ab2a6f
3 changed files with 37 additions and 0 deletions

View File

@@ -462,6 +462,10 @@ type 为 all 时category 参数不支持 cost 和 free
<route name="产业研究报告" author="brilon" example="/iresearch/report" path="/iresearch/report"/> <route name="产业研究报告" author="brilon" example="/iresearch/report" path="/iresearch/report"/>
### MobData
<route name="分析报告" author="brilon" example="/mobdata/report" path="/mobdata/report"/>
### 腾讯谷雨 ### 腾讯谷雨
<Route name="栏目" author="LogicJake" example="/tencent/guyu/channel/lab" path="/tencent/guyu/channel/:name" :paramsDesc="['栏目名称包括labreportstoryshalong']"/> <Route name="栏目" author="LogicJake" example="/tencent/guyu/channel/lab" path="/tencent/guyu/channel/:name" :paramsDesc="['栏目名称包括labreportstoryshalong']"/>

View File

@@ -1217,6 +1217,9 @@ router.get('/infoq/topic/:id', require('./routes/infoq/topic'));
// 艾瑞 // 艾瑞
router.get('/iresearch/report', require('./routes/iresearch/report')); 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')); router.get('/tencent/guyu/channel/:name', require('./routes/tencent/guyu/channel'));

View File

@@ -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}<br><a href="${item.report_path}">查看报告</a>`,
pubDate: date(item.created_at),
link: item.report_path,
}));
ctx.state.data = {
title: 'MobData分析报告',
link: pageUrl,
description: 'MobData分析报告',
item: items,
};
};