From ecebfecc9c06d903c38a346319ef92e6cd0e2033 Mon Sep 17 00:00:00 2001
From: csuhan <1593407377@qq.com>
Date: Thu, 4 Jul 2019 17:12:59 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20add=20=E4=B8=AD=E5=8D=97=E5=A4=A7?=
=?UTF-8?q?=E5=AD=A6=E6=8B=9B=E8=81=98=E4=BF=A1=E6=81=AF=20(#2556)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* 增加中南大学招聘信息
* add 中南大学招聘信息
* 增加中南大学招聘信息
---
docs/university.md | 12 ++++++++++
lib/router.js | 3 +++
lib/routes/universities/csu/job.js | 37 ++++++++++++++++++++++++++++++
3 files changed, 52 insertions(+)
create mode 100644 lib/routes/universities/csu/job.js
diff --git a/docs/university.md b/docs/university.md
index db25897de..d8c7ac82e 100644
--- a/docs/university.md
+++ b/docs/university.md
@@ -899,6 +899,18 @@ https://rsshub.app/**nuist**/`bulletin` 或 https://rsshub.app/**nuist**/`bullet
+## 中南大学
+
+### 招聘信息
+
+
+
+| 招聘类型 | 本部招聘 | 湘雅招聘 | 铁道招聘 | 在线招聘 | 事业招考 |
+| -------- | -------- | -------- | -------- | -------- | -------- |
+| 参数 | 1 | 2 | 3 | 4 | 5 |
+
+
+
## 重庆大学
### 教务网通知公告
diff --git a/lib/router.js b/lib/router.js
index e60cd81ad..89c4bb6b7 100644
--- a/lib/router.js
+++ b/lib/router.js
@@ -634,6 +634,9 @@ router.get('/hust/auto/news/', require('./routes/universities/hust/aia/news'));
router.get('/hust/aia/news/', require('./routes/universities/hust/aia/news'));
router.get('/hust/aia/notice/:type?', require('./routes/universities/hust/aia/notice'));
+// 中南大学
+router.get('/csu/job/:type?', require('./routes/universities/csu/job'));
+
// 山东大学
router.get('/sdu/sc/:type?', require('./routes/universities/sdu/sc'));
router.get('/sdu/cs/:type?', require('./routes/universities/sdu/cs'));
diff --git a/lib/routes/universities/csu/job.js b/lib/routes/universities/csu/job.js
new file mode 100644
index 000000000..52e761a6c
--- /dev/null
+++ b/lib/routes/universities/csu/job.js
@@ -0,0 +1,37 @@
+const got = require('@/utils/got');
+const cheerio = require('cheerio');
+const url = require('url').resolve;
+
+const typeMaps = ['本部招聘', '湘雅招聘', '铁道招聘', '在线招聘', '事业招考'];
+
+module.exports = async (ctx) => {
+ const type = ctx.params.type || 1;
+ const link = 'http://jobsky.csu.edu.cn/Home/PartialArticleList';
+ const response = await got.post(link, {
+ headers: {
+ 'Content-Type': 'application/x-www-form-urlencoded',
+ },
+ body: 'pageindex=1&pagesize=10&typeid=' + type + '&followingdates=-1',
+ });
+ const $ = cheerio.load('
');
+ const list = $('tr');
+ ctx.state.data = {
+ title: '中南大学招聘信息--' + typeMaps[parseInt(type) - 1],
+ link: link,
+ description: '中南大学招聘信息',
+ item:
+ list &&
+ list
+ .map((index, item) => {
+ item = $(item);
+ const pubDate = item.find('.spanDate').text();
+ return {
+ title: item.find('a').text(),
+ description: item.find('a').text(),
+ pubDate: new Date(pubDate).toUTCString(),
+ link: url('http://jobsky.csu.edu.cn/', item.find('a').attr('href')),
+ };
+ })
+ .get(),
+ };
+};