feat(route): add 艾瑞咨询周度市场观察 (#10626)
This commit is contained in:
parent
24c6413cc6
commit
7342326a2a
|
|
@ -334,6 +334,15 @@ type 为 all 时,category 参数不支持 cost 和 free
|
|||
|
||||
<Route author="brilon Fatpandac" example="/iresearch/report" path="/iresearch/report"/>
|
||||
|
||||
### 周度市场观察
|
||||
|
||||
<Route author="nczitzk" example="/iresearch/weekly" path="/iresearch/weekly:category?" :paramsDesc="['分类,见下表,默认为全部']">
|
||||
|
||||
| 家电行业 | 服装行业 | 美妆行业 | 食品饮料行业 |
|
||||
| ---- | ---- | ---- | ------ |
|
||||
|
||||
</Route>
|
||||
|
||||
## 爱 Q 生活网
|
||||
|
||||
### 最近更新
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
module.exports = {
|
||||
'/report': ['brilon', 'Fatpandac'],
|
||||
'/weekly/:category?': ['nczitzk'],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,10 +4,16 @@ module.exports = {
|
|||
www: [
|
||||
{
|
||||
title: '研究报告',
|
||||
docs: 'https://docs.rsshub.app/journal.html#ieee-xplore',
|
||||
docs: 'https://docs.rsshub.app/other.html#ai-rui-chan-ye-yan-jiu-bao-gao',
|
||||
source: ['/report.shtml'],
|
||||
target: '/iresearch/report',
|
||||
},
|
||||
{
|
||||
title: '周度市场观察',
|
||||
docs: 'https://docs.rsshub.app/other.html#ai-rui-zhou-du-shi-chang-guan-cha',
|
||||
source: ['/report.shtml?type=3', ''],
|
||||
target: '/iresearch/weekly/:category',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/report', require('./report'));
|
||||
router.get('/weekly/:category?', require('./weekly'));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
{{ if cover }}
|
||||
<img src="{{ cover }}"
|
||||
{{ /if }}
|
||||
{{ if content }}
|
||||
<p>{{ content }}</p>
|
||||
{{ /if }}
|
||||
{{ if pages }}
|
||||
<% for (let i = 1; i <= pages; i++){ %>
|
||||
<img src="https://pic.iresearch.cn/ireport/{{ id }}/{{ i }}.jpg">
|
||||
<% } %>
|
||||
{{ /if }}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const category = ctx.params.category ?? '';
|
||||
|
||||
const rootUrl = 'https://www.iresearch.com.cn';
|
||||
const currentUrl = `${rootUrl}/report.shtml?type=4`;
|
||||
const apiUrl = `${rootUrl}/api/json/report/ireport.json`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: apiUrl,
|
||||
});
|
||||
|
||||
const items = JSON.parse(response.data.slice(1))
|
||||
.slice(0, ctx.query.limit ? parseInt(ctx.query.limit) : 200)
|
||||
.filter((item) => (category ? item.classname === category : true))
|
||||
.map((item) => ({
|
||||
title: item.reportname,
|
||||
pubDate: parseDate(item.addtime),
|
||||
link: `${rootUrl}/report/detail?id=${item.id}`,
|
||||
category: [item.classname].concat(item.keywords.split(',')),
|
||||
description: art(path.join(__dirname, 'templates/weekly.art'), {
|
||||
id: item.id,
|
||||
cover: item.reportpic,
|
||||
content: item.shortcoutent,
|
||||
pages: item.PagesCount,
|
||||
}),
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
title: '艾瑞咨询 - 周度市场观察',
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue