feat(route): add EMS 苹果邮件 and refactor to V2 (#9175)
This commit is contained in:
parent
f6265ddb8f
commit
5c694e35b3
|
|
@ -54,6 +54,10 @@ pageClass: routes
|
|||
|
||||
<Route author="metowolf HenryQW kt286" example="/apple/exchange_repair/zh-cn" path="/apple/exchange_repair/:country?" :paramsDesc="['苹果官网 URL 中的国家代码, 默认美国 ,中国 `zh-cn`']"/>
|
||||
|
||||
### 苹果邮件
|
||||
|
||||
见 [#中国邮政速递物流](/other.html#zhong-guo-you-zheng-su-di-wu-liu)
|
||||
|
||||
### App Store/Mac App Store
|
||||
|
||||
见 [#app-store-mac-app-store](/program-update.html#app-store-mac-app-store)
|
||||
|
|
@ -1055,6 +1059,10 @@ type 为 all 时,category 参数不支持 cost 和 free
|
|||
|
||||
<Route author="luyuhuang" example="/ems/news" path="/ems/news" radar="1" rssbud="1"/>
|
||||
|
||||
### 苹果邮件
|
||||
|
||||
<Route author="Fatpandac" example="/ems/apple/EZ319397281CN" path="/ems/apple/:id" :paramsDesc="['苹果邮件编号']"/>
|
||||
|
||||
## 自如
|
||||
|
||||
### 房源
|
||||
|
|
|
|||
|
|
@ -2095,17 +2095,6 @@ module.exports = {
|
|||
},
|
||||
],
|
||||
},
|
||||
'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',
|
||||
},
|
||||
],
|
||||
},
|
||||
'popiapp.cn': {
|
||||
_name: 'Popi 提问箱',
|
||||
www: [
|
||||
|
|
|
|||
|
|
@ -3011,9 +3011,6 @@ router.get('/open163/latest', lazyloadRouteHandler('./routes/netease/open/latest
|
|||
// Boston.com
|
||||
router.get('/boston/:tag?', lazyloadRouteHandler('./routes/boston/index'));
|
||||
|
||||
// 中国邮政速递物流
|
||||
router.get('/ems/news', lazyloadRouteHandler('./routes/ems/news'));
|
||||
|
||||
// 场库
|
||||
router.get('/changku', lazyloadRouteHandler('./routes/changku/index'));
|
||||
router.get('/changku/cate/:postid', lazyloadRouteHandler('./routes/changku/index'));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
const got = require('@/utils/got');
|
||||
const { art } = require('@/utils/render');
|
||||
const path = require('path');
|
||||
|
||||
const rootUrl = 'https://www.ems.com.cn';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
const link = `${rootUrl}/apple/query/${id}`;
|
||||
const APIUrl = `${rootUrl}/apple/getMailNoLastRoutes`;
|
||||
|
||||
const { trails } = await got
|
||||
.post(APIUrl, {
|
||||
form: {
|
||||
mailNum: id,
|
||||
},
|
||||
})
|
||||
.json();
|
||||
|
||||
let item;
|
||||
try {
|
||||
item = [
|
||||
{
|
||||
title: `${trails[0][0].despatchCity} → ${trails[0][0].destinationCity}`,
|
||||
link,
|
||||
description: art(path.join(__dirname, 'templates/apple.art'), {
|
||||
trails: trails[0],
|
||||
}),
|
||||
guid: trails[0][0],
|
||||
},
|
||||
];
|
||||
} catch (e) {
|
||||
throw new Error(`没有找到 ${id} 的信息,请检查是否输入正确或者稍后再试。`);
|
||||
}
|
||||
|
||||
ctx.state.data = {
|
||||
allowEmpty: true,
|
||||
title: `Apple EMS 快递 ${id}`,
|
||||
link,
|
||||
item,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = {
|
||||
'/news': ['luyuhuang'],
|
||||
'/apple/:id': ['Fatpandac'],
|
||||
};
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
module.exports = {
|
||||
'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',
|
||||
},
|
||||
{
|
||||
title: '苹果邮件',
|
||||
docs: 'https://docs.rsshub.app/other.html#zhong-guo-you-zheng-su-di-wu-liu',
|
||||
source: ['/apple/query/:id'],
|
||||
target: '/apple/ems/:id',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/news', require('./news'));
|
||||
router.get('/apple/:id', require('./apple'));
|
||||
};
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{{ each trails}}
|
||||
<H2>{{ $value.optime }}</H2>
|
||||
<p>{{ $value.opreateType}} </p>
|
||||
<p>{{ $value.processingInstructions }}</p>
|
||||
<hr>
|
||||
{{/each}}
|
||||
Loading…
Reference in New Issue