feat(router): cebbank 光大银行 (#8293)
This commit is contained in:
parent
fc91df64d7
commit
0e952af6f0
|
|
@ -996,6 +996,24 @@ type 为 all 时,category 参数不支持 cost 和 free
|
|||
|
||||
</Route>
|
||||
|
||||
## 光大银行
|
||||
|
||||
### 外汇牌价
|
||||
|
||||
#### 总览
|
||||
|
||||
<Route author="linbuxiao" example="/quotation/all" path="/quotation/all" />
|
||||
|
||||
#### 历史牌价
|
||||
|
||||
<Route author="linbuxiao" example="/quotation/history/usd" path="/quotation/history/:type" :paramsDesc="['货币的缩写,见下表']">
|
||||
|
||||
| 美元 | 英镑 | 港币 | 瑞士法郎 | 瑞典克郎 | 丹麦克郎 | 挪威克郎 | 日元 | 加拿大元 | 澳大利亚元 | 新加坡元 | 欧元 | 澳门元 | 泰国铢 | 新西兰元 | 韩圆 |
|
||||
|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|
|
||||
| usd | gbp | hkd | chf | sek | dkk | nok | jpy | cad | aud | sgd | eur | mop | thb | nzd | krw |
|
||||
|
||||
</Route>
|
||||
|
||||
## 中国邮政速递物流
|
||||
|
||||
### 新闻
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const path = require('path');
|
||||
const { art } = require('@/utils/render');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = `https://www.cebbank.com/eportal/ui?pageId=477257`;
|
||||
const content = await got({
|
||||
method: 'get',
|
||||
url: link,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(content.data);
|
||||
|
||||
const items = $('.lczj_box tbody tr')
|
||||
.map((i, e) => {
|
||||
if (i < 2) {
|
||||
return null;
|
||||
}
|
||||
const c = cheerio.load(e, { decodeEntities: false });
|
||||
return {
|
||||
title: c('td:nth-child(1)').text(),
|
||||
description: art(path.join(__dirname, 'templates/allDes.art'), {
|
||||
fcer: c('td:nth-child(2)').text(),
|
||||
pmc: c('td:nth-child(3)').text(),
|
||||
exrt: c('td:nth-child(4)').text(),
|
||||
mc: c('td:nth-child(5)').text(),
|
||||
}),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: '中国光大银行',
|
||||
description: '中国光大银行 外汇牌价',
|
||||
pubDate: timezone(parseDate($('#t_id span').text().substring(5), 'YYYY-MM-DD HH:mm', true), 0),
|
||||
item: items,
|
||||
};
|
||||
|
||||
ctx.state.json = {
|
||||
title: '中国光大银行',
|
||||
description: '中国光大银行 外汇牌价',
|
||||
pubDate: timezone(parseDate($('#t_id span').text().substring(5), 'YYYY-MM-DD HH:mm', true), 0),
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const path = require('path');
|
||||
const { art } = require('@/utils/render');
|
||||
const utils = require('./utils');
|
||||
|
||||
const { TYPE } = utils;
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = ctx.params.type;
|
||||
const url = `https://www.cebbank.com/eportal/ui?struts.portlet.action=/portlet/whpjFront!toView.action&moduleId=12094&pageId=477260&currcode=${TYPE[type].id}¤tPagebak=1¤tPage=1`;
|
||||
const res = await got({
|
||||
method: 'get',
|
||||
url,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(res.data);
|
||||
|
||||
const items = $('.lczj_box tbody tr')
|
||||
.map((i, e) => {
|
||||
if (i < 2) {
|
||||
return null;
|
||||
}
|
||||
const c = cheerio.load(e, { decodeEntities: false });
|
||||
return {
|
||||
title: c('td:nth-child(1)').text(),
|
||||
description: art(path.join(__dirname, 'templates/historyDes.art'), {
|
||||
fcer: c('td:nth-child(2)').text(),
|
||||
pmc: c('td:nth-child(3)').text(),
|
||||
exrt: c('td:nth-child(4)').text(),
|
||||
mc: c('td:nth-child(5)').text(),
|
||||
time: c('td:nth-child(6)').text(),
|
||||
}),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
items.pop();
|
||||
ctx.state.data = {
|
||||
title: '中国光大银行',
|
||||
description: `中国光大银行 外汇牌价 ${TYPE[type].name}`,
|
||||
item: items,
|
||||
};
|
||||
|
||||
ctx.state.json = {
|
||||
title: '中国光大银行',
|
||||
description: `中国光大银行 外汇牌价 ${TYPE[type].name}`,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = {
|
||||
'/quotation/all': ['linbuxiao'],
|
||||
'/quotation/history/:type': ['linbuxiao'],
|
||||
};
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
module.exports = {
|
||||
'cebbank.com': {
|
||||
_name: '中国光大银行',
|
||||
'.': [
|
||||
{
|
||||
title: '外汇牌价 - 牌价总览',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#eprice',
|
||||
source: ['/eportal/ui?pageId=477257'],
|
||||
target: '/quotation/all',
|
||||
},
|
||||
{
|
||||
title: '外汇牌价 - 历史记录',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#eprice',
|
||||
source: ['/site/ygzx/whpj/rmbwhpjlspj/index.html?currcode=:id'],
|
||||
target: ({ id }) => `/quotation/${id}`,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/quotation/all', require('./all'));
|
||||
router.get('/quotation/history/:type', require('./history'));
|
||||
};
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
<p>购汇:{{ fcer }},购钞:{{ pmc }}</p>
|
||||
<p>结汇: {{ exrt }},结钞:{{ mc }}</p>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<p>更新时间: {{ time }}</>
|
||||
<p>购汇:{{ fcer }},购钞:{{ pmc }}</p>
|
||||
<p>结汇: {{ exrt }},结钞:{{ mc }}</p>
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
const TYPE = {
|
||||
usd: {
|
||||
name: '美元(USD)',
|
||||
id: 14,
|
||||
},
|
||||
gbp: {
|
||||
name: '英镑(GBP)',
|
||||
id: 12,
|
||||
},
|
||||
hkd: {
|
||||
name: '港币(HKD)',
|
||||
id: 13,
|
||||
},
|
||||
chf: {
|
||||
name: '瑞士法郎(CHF)',
|
||||
id: 15,
|
||||
},
|
||||
sek: {
|
||||
name: '瑞典克郎(SEK)',
|
||||
id: 21,
|
||||
},
|
||||
dkk: {
|
||||
name: '丹麦克郎(DKK)',
|
||||
id: 22,
|
||||
},
|
||||
nok: {
|
||||
name: '挪威克郎(NOK)',
|
||||
id: 23,
|
||||
},
|
||||
jpy: {
|
||||
name: '日元(JPY)',
|
||||
id: 27,
|
||||
},
|
||||
cad: {
|
||||
name: '加拿大元(CAD)',
|
||||
id: 28,
|
||||
},
|
||||
aud: {
|
||||
name: '澳大利亚元(AUD)',
|
||||
id: 29,
|
||||
},
|
||||
sgd: {
|
||||
name: '新加坡元(SGD)',
|
||||
id: 32,
|
||||
},
|
||||
eur: {
|
||||
name: '欧元(EUR)',
|
||||
id: 38,
|
||||
},
|
||||
mop: {
|
||||
name: '澳门元(MOP)',
|
||||
id: 81,
|
||||
},
|
||||
thb: {
|
||||
name: '泰国铢(THB)',
|
||||
id: 84,
|
||||
},
|
||||
nzd: {
|
||||
name: '新西兰元(NZD)',
|
||||
id: 87,
|
||||
},
|
||||
krw: {
|
||||
name: '韩圆(KRW)',
|
||||
id: 88,
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
TYPE,
|
||||
};
|
||||
Loading…
Reference in New Issue