mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat(route): add 中国民用航空局公众留言 (#14109)
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
const got = require('@/utils/got');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { category = '' } = ctx.params;
|
||||
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 30;
|
||||
|
||||
const rootUrl = 'https://www.caac.gov.cn';
|
||||
const apiUrl = new URL(`caacgov/jsonp/messageBoard/visit/get${category ? 'CJWT' : ''}List`, rootUrl).href;
|
||||
const currentUrl = new URL('HDJL/', rootUrl).href;
|
||||
|
||||
const { data: response } = await got(apiUrl, {
|
||||
searchParams: {
|
||||
callbackparam: 'jsonp_messageBoard_getList',
|
||||
infoMess: category,
|
||||
pageIndex: 1,
|
||||
},
|
||||
});
|
||||
|
||||
const items = JSON.parse(response.match(/jsonp_messageBoard_getList\((.*?)\)$/)[1])
|
||||
.returnData.root.slice(0, limit)
|
||||
.map((item) => ({
|
||||
title: item.infoMess.replace(/<\/?em>/g, ''),
|
||||
link: new URL(`index_180.html?info=${item.id}&type=id`, rootUrl).href,
|
||||
description: art(path.join(__dirname, 'templates/description.art'), {
|
||||
item,
|
||||
}),
|
||||
author: `${item.gname}/${item.feedbackName}`,
|
||||
category: [item.messageType],
|
||||
guid: `caac-cjwt#${item.id}`,
|
||||
pubDate: timezone(parseDate(item.createDate), +8),
|
||||
updated: timezone(parseDate(item.feedbackDate), +8),
|
||||
}));
|
||||
|
||||
const author = '中国民用航空局';
|
||||
const image = new URL('images/Logo2.png', rootUrl).href;
|
||||
const icon = new URL('images/weixinLogo.jpg', rootUrl).href;
|
||||
const subtitle = '公众留言';
|
||||
|
||||
ctx.state.data = {
|
||||
item: items,
|
||||
title: [author, subtitle, category].filter((i) => i).join(' - '),
|
||||
link: currentUrl,
|
||||
description: '向公众提供服务和开展互动交流',
|
||||
language: 'zh',
|
||||
image,
|
||||
icon,
|
||||
logo: icon,
|
||||
subtitle,
|
||||
author,
|
||||
allowEmpty: true,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
<div>
|
||||
<dl>
|
||||
<dt>
|
||||
<label>【{{ item.messageType }}】</label>
|
||||
<span>{{ item.workUnit }}</span>
|
||||
<span>{{ item.gname }}</span>
|
||||
<span>{{ item.createDate }}</span>
|
||||
</dt>
|
||||
<dd style="margin-top:10px; color:#EF7321;">
|
||||
<p style="text-indent:1em;">
|
||||
{{@ item.infoMess }}
|
||||
</p>
|
||||
</dd>
|
||||
<dt width="140px">
|
||||
<label>【回复】</label>
|
||||
<span>{{ item.feedbackName }}</span>
|
||||
<span>{{ item.feedbackDate }}</span>
|
||||
</dt>
|
||||
<dd>
|
||||
<p style="text-indent:1em;">
|
||||
{{@ item.feedback }}
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
@@ -1,6 +1,7 @@
|
||||
module.exports = {
|
||||
// ministry
|
||||
'/cac/:path+': ['drgnchan'],
|
||||
'/caac/cjwt/:category?': ['nczitzk'],
|
||||
'/ccdi/:path+': ['bigfei'],
|
||||
'/chinamine-safety/zfxxgk/:category?': ['nczitzk'],
|
||||
'/chinamine-safety/xw/:category?': ['nczitzk'],
|
||||
|
||||
@@ -319,6 +319,53 @@ module.exports = {
|
||||
},
|
||||
],
|
||||
},
|
||||
'caac.gov.cn': {
|
||||
_name: '中国民用航空局',
|
||||
'.': [
|
||||
{
|
||||
title: '公众留言',
|
||||
docs: 'https://docs.rsshub.app/routes/government#zhong-guo-min-yong-hang-kong-ju-gong-zhong-liu-yan',
|
||||
source: ['/HDJL/'],
|
||||
target: '/gov/caac/cjwt',
|
||||
},
|
||||
{
|
||||
title: '公众留言 - 机票',
|
||||
docs: 'https://docs.rsshub.app/routes/government#zhong-guo-min-yong-hang-kong-ju-gong-zhong-liu-yan',
|
||||
source: ['/HDJL/'],
|
||||
target: '/gov/caac/cjwt/机票',
|
||||
},
|
||||
{
|
||||
title: '公众留言 - 托运',
|
||||
docs: 'https://docs.rsshub.app/routes/government#zhong-guo-min-yong-hang-kong-ju-gong-zhong-liu-yan',
|
||||
source: ['/HDJL/'],
|
||||
target: '/gov/caac/cjwt/托运',
|
||||
},
|
||||
{
|
||||
title: '公众留言 - 无人机',
|
||||
docs: 'https://docs.rsshub.app/routes/government#zhong-guo-min-yong-hang-kong-ju-gong-zhong-liu-yan',
|
||||
source: ['/HDJL/'],
|
||||
target: '/gov/caac/cjwt/无人机',
|
||||
},
|
||||
{
|
||||
title: '公众留言 - 体检',
|
||||
docs: 'https://docs.rsshub.app/routes/government#zhong-guo-min-yong-hang-kong-ju-gong-zhong-liu-yan',
|
||||
source: ['/HDJL/'],
|
||||
target: '/gov/caac/cjwt/体检',
|
||||
},
|
||||
{
|
||||
title: '公众留言 - 行政审批',
|
||||
docs: 'https://docs.rsshub.app/routes/government#zhong-guo-min-yong-hang-kong-ju-gong-zhong-liu-yan',
|
||||
source: ['/HDJL/'],
|
||||
target: '/gov/caac/cjwt/行政审批',
|
||||
},
|
||||
{
|
||||
title: '公众留言 - 投诉',
|
||||
docs: 'https://docs.rsshub.app/routes/government#zhong-guo-min-yong-hang-kong-ju-gong-zhong-liu-yan',
|
||||
source: ['/HDJL/'],
|
||||
target: '/gov/caac/cjwt/投诉',
|
||||
},
|
||||
],
|
||||
},
|
||||
'ccdi.gov.cn': {
|
||||
_name: '中央纪委国家监委',
|
||||
www: [
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
module.exports = function (router) {
|
||||
// ministry
|
||||
router.get(/cac(\/[\w/-]+)?/, require('./cac/index'));
|
||||
router.get('/caac/cjwt/:category?', require('./caac/cjwt'));
|
||||
router.get(/ccdi(\/[\w/-]+)?/, require('./ccdi'));
|
||||
router.get('/chinamine-safety/zfxxgk/:category*', require('./chinamine-safety/zfxxgk'));
|
||||
router.get('/chinamine-safety/xw/:category*', require('./chinamine-safety/xw'));
|
||||
|
||||
@@ -1308,6 +1308,15 @@
|
||||
|
||||
<Route author="TonyRL" example="/cast" path="/cast/:column?" paramsDesc={['栏目 ID,即 URL 中的数字,默认为 `457`']} radar="1" notOperational="1" />
|
||||
|
||||
## 中国民用航空局 {#zhong-guo-min-yong-hang-kong-ju}
|
||||
|
||||
### 公众留言 {#zhong-guo-min-yong-hang-kong-ju-gong-zhong-liu-yan}
|
||||
|
||||
<Route author="nczitzk" example="/gov/caac/cjwt" path="/gov/caac/cjwt/:category?" paramsDesc={['分类,见下表,默认为全部']} radar="1">
|
||||
| 机票 | 托运 | 无人机 | 体检 | 行政审批 | 投诉 |
|
||||
| ---- | ---- | ------ | ---- | -------- | ---- |
|
||||
</Route>
|
||||
|
||||
## 中国农工民主党 {#zhong-guo-nong-gong-min-zhu-dang}
|
||||
|
||||
### 新闻中心 {#zhong-guo-nong-gong-min-zhu-dang-xin-wen-zhong-xin}
|
||||
|
||||
Reference in New Issue
Block a user