From 3539021c43d45242eeaee82ef3b98a86881a0450 Mon Sep 17 00:00:00 2001 From: Ethan Shen Date: Sat, 27 Nov 2021 16:42:27 +0800 Subject: [PATCH] =?UTF-8?q?feat(route):=20add=20=E5=8C=97=E4=BA=AC?= =?UTF-8?q?=E7=90=86=E5=B7=A5=E5=A4=A7=E5=AD=A6=E4=BA=BA=E6=89=8D=E6=8B=9B?= =?UTF-8?q?=E8=81=98=20(#8437)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/university.md | 4 ++++ lib/v2/bit/maintainer.js | 3 +++ lib/v2/bit/radar.js | 13 +++++++++++++ lib/v2/bit/router.js | 3 +++ lib/v2/bit/rszhaopin.js | 30 ++++++++++++++++++++++++++++++ 5 files changed, 53 insertions(+) create mode 100644 lib/v2/bit/maintainer.js create mode 100644 lib/v2/bit/radar.js create mode 100644 lib/v2/bit/router.js create mode 100644 lib/v2/bit/rszhaopin.js diff --git a/docs/university.md b/docs/university.md index a247f9fdcf..cbb03e4aa4 100644 --- a/docs/university.md +++ b/docs/university.md @@ -182,6 +182,10 @@ pageClass: routes +### 人才招聘 + + + ## 北京林业大学 ### 绿色新闻网 diff --git a/lib/v2/bit/maintainer.js b/lib/v2/bit/maintainer.js new file mode 100644 index 0000000000..9dd417bee9 --- /dev/null +++ b/lib/v2/bit/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/rszhaopin': ['nczitzk'], +}; diff --git a/lib/v2/bit/radar.js b/lib/v2/bit/radar.js new file mode 100644 index 0000000000..0d73faa9af --- /dev/null +++ b/lib/v2/bit/radar.js @@ -0,0 +1,13 @@ +module.exports = { + 'bit.edu.cn': { + _name: '北京理工大学', + rszhaopin: [ + { + title: '人才招聘', + docs: 'https://docs.rsshub.app/university.html#bei-jing-li-gong-da-xue-ren-cai-zhao-pin', + source: ['/'], + target: '/bit/:category?', + }, + ], + }, +}; diff --git a/lib/v2/bit/router.js b/lib/v2/bit/router.js new file mode 100644 index 0000000000..8b006ea98e --- /dev/null +++ b/lib/v2/bit/router.js @@ -0,0 +1,3 @@ +module.exports = function (router) { + router.get('/rszhaopin', require('./rszhaopin')); +}; diff --git a/lib/v2/bit/rszhaopin.js b/lib/v2/bit/rszhaopin.js new file mode 100644 index 0000000000..e5e6a940f0 --- /dev/null +++ b/lib/v2/bit/rszhaopin.js @@ -0,0 +1,30 @@ +const got = require('@/utils/got'); +const { parseDate } = require('@/utils/parse-date'); + +module.exports = async (ctx) => { + const rootUrl = 'https://rszhaopin.bit.edu.cn'; + const apiUrl = `${rootUrl}/ajax/ajaxService`; + const currentUrl = `${rootUrl}/zp.html#/notices/0`; + + const response = await got({ + method: 'post', + url: apiUrl, + form: { + __xml: 'A2GgW6kPrLjaqavT0I8o9cOIXCYxazGialM66OpRk0MhwwOeUI1mF8yRBJHzicA9uL8Y9gYrXjdMocslRUopTMDJSRAykGXsjUoPibT4uK8Rz8Zj7U00coBCcJibpVwRZzFk', + __type: 'extTrans', + }, + }); + + const items = response.data.return_data.list.map((item) => ({ + title: item.title, + description: item.content, + pubDate: parseDate(item.createtime), + link: `${rootUrl}/zp.html#/notice/${item.id}`, + })); + + ctx.state.data = { + title: '人才招聘 - 北京理工大学', + link: currentUrl, + item: items, + }; +};