feat: add route for ems (#4986)

This commit is contained in:
Luyu Huang 2020-06-15 11:37:55 +08:00 committed by GitHub
parent 6d7ab13150
commit be3d878eb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 2 deletions

View File

@ -2068,4 +2068,15 @@
},
],
},
'ems.com.cn': {
_name: '中国邮政速递物流',
www: [
{
title: '新闻',
docs: 'https://docs.rsshub.app/other.html#zhong-guo-you-zheng-su-di-wu-liu',
source: '/aboutus/xin_wen_yu_shi_jian.html',
target: '/ems/news',
},
],
},
});

View File

@ -627,8 +627,8 @@ type 为 all 时category 参数不支持 cost 和 free
### 源仓库更新
<Route author="vhxubo" example="/ku" path="/ku/:name?" :paramsDesc="['默认为 `yuedu`']">
| 阅读 | 异次元 | 海阔 |
| ---- | ----- | ---- |
| 阅读 | 异次元 | 海阔 |
| ---- | ----- | ---- |
| yuedu | yiciyuan | haikuo |
</Route>
@ -681,6 +681,12 @@ type 为 all 时category 参数不支持 cost 和 free
</Route>
## 中国邮政速递物流
### 新闻
<Route author="luyuhuang" example="/ems/news" path="/ems/news" radar="1"/>
## 自如
### 房源

View File

@ -2861,6 +2861,9 @@ router.get('/jike/user/:id', require('./routes/jike/user'));
// 网易新闻
router.get('/netease/news/rank/:category?/:type?/:time?', require('./routes/netease/news/rank'));
// 中国邮政速递物流
router.get('/ems/news', require('./routes/ems/news'));
// 场库
router.get('/changku', require('./routes/changku/index'));

21
lib/routes/ems/news.js Normal file
View File

@ -0,0 +1,21 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
const response = await got({
method: 'get',
url: 'http://www.ems.com.cn/ems/news/listNews',
});
const items = response.data.map((item) => ({
title: item.title,
link: `http://www.ems.com.cn/ems/news/viewNews?id=${item.id}`,
pubDate: item.postDate,
description: item.content,
}));
ctx.state.data = {
title: '中国邮政速递物流',
link: 'http://www.ems.com.cn/',
item: items,
};
};