feat(route): add 北京理工大学人才招聘 (#8437)

This commit is contained in:
Ethan Shen
2021-11-27 08:42:27 +00:00
committed by GitHub
parent b9bb7555d0
commit 3539021c43
5 changed files with 53 additions and 0 deletions
+4
View File
@@ -182,6 +182,10 @@ pageClass: routes
<Route author="sinofp" example="/bit/cs" path="/bit/cs" />
### 人才招聘
<Route author="nczitzk" example="/bit/rszhaopin" path="/bit/rszhaopin" />
## 北京林业大学
### 绿色新闻网
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
'/rszhaopin': ['nczitzk'],
};
+13
View File
@@ -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?',
},
],
},
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/rszhaopin', require('./rszhaopin'));
};
+30
View File
@@ -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,
};
};