feat(route): add 国家外汇管理局业务咨询 & 投诉建议 (#13995)
This commit is contained in:
@@ -49,6 +49,8 @@ module.exports = {
|
||||
'/pbc/tradeAnnouncement': ['nczitzk'],
|
||||
'/pbc/zcyj': ['Fatpandac'],
|
||||
'/samr/xgzlyhd/:category?/:department?': ['nczitzk'],
|
||||
'/safe/bussiness/:site?': ['nczitzk'],
|
||||
'/safe/complaint/:site?': ['nczitzk'],
|
||||
'/sasac/:path+': ['TonyRL'],
|
||||
'/stats/:path+': ['bigfei', 'nczitzk'],
|
||||
'/zhengce/govall/:advance?': ['ciaranchen'],
|
||||
|
||||
@@ -1185,6 +1185,31 @@ module.exports = {
|
||||
},
|
||||
],
|
||||
},
|
||||
'safe.gov.cn': {
|
||||
_name: '国家外汇管理局',
|
||||
'.': [
|
||||
{
|
||||
title: '业务咨询',
|
||||
docs: 'https://docs.rsshub.app/routes/government#guo-jia-wai-hui-guan-li-ju-ye-wu-zi-xun',
|
||||
source: ['/:site/ywzx/index.html'],
|
||||
target: (params) => {
|
||||
const site = params.site;
|
||||
|
||||
return `/gov/safe/business/${site}`;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '投诉建议',
|
||||
docs: 'https://docs.rsshub.app/routes/government#guo-jia-wai-hui-guan-li-ju-tou-su-jian-yi',
|
||||
source: ['/:site/tsjy/index.html'],
|
||||
target: (params) => {
|
||||
const site = params.site;
|
||||
|
||||
return `/gov/safe/complaint/${site}`;
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
'sasac.gov.cn': {
|
||||
_name: '国务院国有资产监督管理委员会',
|
||||
'.': [
|
||||
|
||||
@@ -41,6 +41,8 @@ module.exports = function (router) {
|
||||
router.get('/pbc/gzlw', require('./pbc/gzlw'));
|
||||
router.get('/pbc/tradeAnnouncement', require('./pbc/tradeAnnouncement'));
|
||||
router.get('/pbc/zcyj', require('./pbc/zcyj'));
|
||||
router.get('/safe/business/:site?', require('./safe/business'));
|
||||
router.get('/safe/complaint/:site?', require('./safe/complaint'));
|
||||
router.get('/samr/xgzlyhd/:category?/:department?', require('./samr/xgzlyhd'));
|
||||
router.get('/sasac/:path+', require('./sasac/generic'));
|
||||
router.get(/stats(\/[\w/-]+)?/, require('./stats'));
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
const { processZxfkItems } = require('./util');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { site = 'beijing' } = ctx.params;
|
||||
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 3;
|
||||
|
||||
ctx.state.data = await processZxfkItems(site, 'ywzx', limit);
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
const { processZxfkItems } = require('./util');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { site = 'beijing' } = ctx.params;
|
||||
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 5;
|
||||
|
||||
ctx.state.data = await processZxfkItems(site, 'tsjy', limit);
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>留言人</th>
|
||||
<th>留言内容</th>
|
||||
<th>留言时间</th>
|
||||
</tr>
|
||||
{{ if message }}
|
||||
{{ set object = message }}
|
||||
<tr>
|
||||
<td>{{ object.author }}</td>
|
||||
<td>{{ object.content }}</td>
|
||||
<td>{{ object.date }}</td>
|
||||
</tr>
|
||||
{{ /if }}
|
||||
{{ if reply }}
|
||||
{{ set object = reply }}
|
||||
<tr style="color: #0069ae;">
|
||||
<td>{{ object.author }}</td>
|
||||
<td>{{ object.content }}</td>
|
||||
<td>{{ object.date }}</td>
|
||||
</tr>
|
||||
{{ /if }}
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -0,0 +1,87 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
const path = require('path');
|
||||
|
||||
const rootUrl = 'https://www.safe.gov.cn';
|
||||
|
||||
const zxfkCategoryApis = {
|
||||
// 业务咨询 https://www.safe.gov.cn/<site>/ywzx/index.html
|
||||
ywzx: 'www/busines/businessQuery?siteid=',
|
||||
|
||||
// 投诉建议 https://www.safe.gov.cn/<site>/tsjy/index.html
|
||||
tsjy: 'www/complaint/complaintQuery?siteid=',
|
||||
};
|
||||
|
||||
const processZxfkItems = async (site = 'beijing', category = 'ywzx', limit = '3') => {
|
||||
const apiUrl = new URL(`${zxfkCategoryApis[category]}${site}`, rootUrl).href;
|
||||
const currentUrl = new URL(`${site}/${category}/index.html`, rootUrl).href;
|
||||
|
||||
const { data: response } = await got(apiUrl);
|
||||
|
||||
const $ = cheerio.load(response);
|
||||
|
||||
const items = $('#complaint')
|
||||
.slice(0, limit)
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
|
||||
const spans = item.find('span[objid]');
|
||||
|
||||
const message = {
|
||||
author: spans.first().text().replace(/:$/, ''),
|
||||
content: spans.eq(1).text(),
|
||||
date: spans.eq(2).text(),
|
||||
};
|
||||
|
||||
const reply = {
|
||||
author: spans.eq(3).text().replace(/:$/, ''),
|
||||
content: spans.eq(4).text(),
|
||||
date: spans.eq(5).text(),
|
||||
};
|
||||
|
||||
return {
|
||||
title: `${message.author}: ${message.content}`,
|
||||
link: new URL(item.find('.title').prop('href'), rootUrl).href,
|
||||
description: art(path.join(__dirname, 'templates/message.art'), {
|
||||
message,
|
||||
reply,
|
||||
}),
|
||||
author: `${message.author}/${reply.author}`,
|
||||
guid: item.find('.id').text(),
|
||||
pubDate: parseDate(message.date),
|
||||
updated: parseDate(reply.date),
|
||||
};
|
||||
});
|
||||
|
||||
const { data: currentResponse } = await got(currentUrl);
|
||||
|
||||
const content = cheerio.load(currentResponse);
|
||||
|
||||
const author = content('meta[name="ColumnName"]').prop('content');
|
||||
const subtitle = content('meta[name="ColumnType"]').prop('content');
|
||||
|
||||
const imagePath = 'safe/templateresource/372b1dfdab204181b9b4f943a8e926a6';
|
||||
const image = new URL(`${imagePath}/logo_06.png`, rootUrl).href;
|
||||
const icon = new URL(`${imagePath}/safe.ico`, rootUrl).href;
|
||||
|
||||
return {
|
||||
item: items,
|
||||
title: `${author} - ${subtitle}`,
|
||||
link: currentUrl,
|
||||
description: content('meta[name="ColumnDescription"]').prop('content'),
|
||||
language: 'zh',
|
||||
image,
|
||||
icon,
|
||||
logo: icon,
|
||||
subtitle,
|
||||
author,
|
||||
allowEmpty: true,
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
processZxfkItems,
|
||||
};
|
||||
@@ -618,6 +618,57 @@ Language
|
||||
|
||||
</Route>
|
||||
|
||||
## 国家外汇管理局 {#guo-jia-wai-hui-guan-li-ju}
|
||||
|
||||
<details>
|
||||
<summary>*业务咨询* 和 *投诉建议* 可用的站点参数</summary>
|
||||
|
||||
| 上海市 | 北京市 | 天津市 | 河北省 |
|
||||
| -------- | ------- | ------- | ----- |
|
||||
| shanghai | beijing | tianjin | hebei |
|
||||
|
||||
| 山西省 | 内蒙古自治区 | 辽宁省 | 吉林省 |
|
||||
| ------ | --------- | -------- | ----- |
|
||||
| shanxi | neimenggu | liaoning | jilin |
|
||||
|
||||
| 黑龙江省 | 江苏省 | 浙江省 | 安徽省 |
|
||||
| ------------ | ------- | -------- | ----- |
|
||||
| heilongjiang | jiangsu | zhejiang | anhui |
|
||||
|
||||
| 福建省 | 江西省 | 山东省 | 河南省 |
|
||||
| ------ | ------- | -------- | ----- |
|
||||
| fujian | jiangxi | shandong | henan |
|
||||
|
||||
| 湖北省 | 湖南省 | 广东省 | 广西壮族自治区 |
|
||||
| ----- | ----- | --------- | ------- |
|
||||
| hubei | hunan | guangdong | guangxi |
|
||||
|
||||
| 海南省 | 重庆市 | 四川省 | 贵州省 |
|
||||
| ------ | --------- | ------- | ------- |
|
||||
| hainan | chongqing | sichuan | guizhou |
|
||||
|
||||
| 云南省 | 西藏自治区 | 陕西省 | 甘肃省 |
|
||||
| ------ | ------ | ------- | ----- |
|
||||
| yunnan | xizang | shaanxi | gansu |
|
||||
|
||||
| 青海省 | 宁夏回族自治区 | 新疆维吾尔自治区 | 大连市 |
|
||||
| ------- | ------- | -------- | ------ |
|
||||
| qinghai | ningxia | xinjiang | dalian |
|
||||
|
||||
| 宁波市 | 厦门市 | 青岛市 | 深圳市 |
|
||||
| ------ | ------ | ------- | -------- |
|
||||
| ningbo | xiamen | qingdao | shenzhen |
|
||||
|
||||
</details>
|
||||
|
||||
### 业务咨询 {#guo-jia-wai-hui-guan-li-ju-ye-wu-zi-xun}
|
||||
|
||||
<Route author="nczitzk" example="/gov/safe/business/beijing" path="/gov/safe/business/:site?" paramsDesc={['站点,见上表,默认为 beijing']} radar="1"/>
|
||||
|
||||
### 投诉建议 {#guo-jia-wai-hui-guan-li-ju-tou-su-jian-yi}
|
||||
|
||||
<Route author="nczitzk" example="/gov/safe/complaint/beijing" path="/gov/safe/complaint/:site?" paramsDesc={['站点,见上表,默认为 beijing']} radar="1"/>
|
||||
|
||||
## 国家新闻出版广电总局(弃用) {#guo-jia-xin-wen-chu-ban-guang-dian-zong-ju-qi-yong}
|
||||
|
||||
### 游戏审批结果 {#guo-jia-xin-wen-chu-ban-guang-dian-zong-ju-qi-yong-you-xi-shen-pi-jie-guo}
|
||||
|
||||
Reference in New Issue
Block a user