diff --git a/lib/v2/gov/caac/cjwt.js b/lib/v2/gov/caac/cjwt.js new file mode 100644 index 00000000000000..7b3952e9c7cd86 --- /dev/null +++ b/lib/v2/gov/caac/cjwt.js @@ -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, + }; +}; diff --git a/lib/v2/gov/caac/templates/description.art b/lib/v2/gov/caac/templates/description.art new file mode 100644 index 00000000000000..3e87d9271250d6 --- /dev/null +++ b/lib/v2/gov/caac/templates/description.art @@ -0,0 +1,25 @@ +
+
+
+ + {{ item.workUnit }} + {{ item.gname }} + {{ item.createDate }} +
+
+

+ {{@ item.infoMess }} +

+
+
+ + {{ item.feedbackName }} + {{ item.feedbackDate }} +
+
+

+ {{@ item.feedback }} +

+
+
+
\ No newline at end of file diff --git a/lib/v2/gov/maintainer.js b/lib/v2/gov/maintainer.js index 10c44c9839f3a6..cfbb2c6a8d0a63 100644 --- a/lib/v2/gov/maintainer.js +++ b/lib/v2/gov/maintainer.js @@ -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'], diff --git a/lib/v2/gov/radar.js b/lib/v2/gov/radar.js index 94eb35f293ca50..8b805f8a3b03e5 100644 --- a/lib/v2/gov/radar.js +++ b/lib/v2/gov/radar.js @@ -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: [ diff --git a/lib/v2/gov/router.js b/lib/v2/gov/router.js index 42b1a5ab5059f7..65720984336cb1 100644 --- a/lib/v2/gov/router.js +++ b/lib/v2/gov/router.js @@ -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')); diff --git a/website/docs/routes/government.mdx b/website/docs/routes/government.mdx index 6d50828dc2f2a1..f1458051181516 100644 --- a/website/docs/routes/government.mdx +++ b/website/docs/routes/government.mdx @@ -1308,6 +1308,15 @@ +## 中国民用航空局 {#zhong-guo-min-yong-hang-kong-ju} + +### 公众留言 {#zhong-guo-min-yong-hang-kong-ju-gong-zhong-liu-yan} + + + | 机票 | 托运 | 无人机 | 体检 | 行政审批 | 投诉 | + | ---- | ---- | ------ | ---- | -------- | ---- | + + ## 中国农工民主党 {#zhong-guo-nong-gong-min-zhu-dang} ### 新闻中心 {#zhong-guo-nong-gong-min-zhu-dang-xin-wen-zhong-xin}