feature: 增加浙大软件学院通知 (#3166)

This commit is contained in:
yonvenne
2019-10-09 11:09:01 +08:00
committed by DIYgod
parent 2204388bbd
commit c13e55a4ff
3 changed files with 77 additions and 3 deletions

View File

@@ -957,7 +957,7 @@ https://rsshub.app/**nuist**/`bulletin` 或 https://rsshub.app/**nuist**/`bullet
### 浙大研究生院 ### 浙大研究生院
<Route author="Caicailiushui" example="/zju/grs/1" path="/universities/zju/grs/:type" :paramsDesc="['1 为 全部公告, 2 为教学管理, 3 为各类资助,4 为学科建设, 5 为海外交流']"> <Route author="Caicailiushui" example="/zju/grs/1" path="/zju/grs/:type" :paramsDesc="['1 为 全部公告, 2 为教学管理, 3 为各类资助,4 为学科建设, 5 为海外交流']">
| 全部公告 | 教学管理 | 各类资助 | 学科建设 | 海外交流 | | 全部公告 | 教学管理 | 各类资助 | 学科建设 | 海外交流 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
@@ -967,7 +967,7 @@ https://rsshub.app/**nuist**/`bulletin` 或 https://rsshub.app/**nuist**/`bullet
### 浙大就业服务平台 ### 浙大就业服务平台
<Route author="Caicailiushui" example="/zju/career/1" path="/universities/zju/career/:type" :paramsDesc="['1 为新闻动态, 2 为活动通知, 3 为学院通知, 4 为告示通知 ']"> <Route author="Caicailiushui" example="/zju/career/1" path="/zju/career/:type" :paramsDesc="['1 为新闻动态, 2 为活动通知, 3 为学院通知, 4 为告示通知 ']">
| 新闻动态 | 活动通知 | 学院通知 | 告示通知 | | 新闻动态 | 活动通知 | 学院通知 | 告示通知 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
@@ -977,7 +977,7 @@ https://rsshub.app/**nuist**/`bulletin` 或 https://rsshub.app/**nuist**/`bullet
### 浙大物理系 ### 浙大物理系
<Route author="Caicailiushui" example="/zju/physics/1" path="/universities/zju/physics/:type" :paramsDesc="['1 为本系动态, 2 为科研通知, 3 为研究生教育最新消息, 4 为学生思政最新消息, 5 为研究生思政消息公告, 6 为研究生奖助学金, 7 为研究生思政就业信息,8 为本科生思政消息公告,9 为本科生奖助学金, 10 为本科生就业信息, 11 为学术报告']"> <Route author="Caicailiushui" example="/zju/physics/1" path="/zju/physics/:type" :paramsDesc="['1 为本系动态, 2 为科研通知, 3 为研究生教育最新消息, 4 为学生思政最新消息, 5 为研究生思政消息公告, 6 为研究生奖助学金, 7 为研究生思政就业信息,8 为本科生思政消息公告,9 为本科生奖助学金, 10 为本科生就业信息, 11 为学术报告']">
| 本系动态 | 科研通知 | 研究生教育最新消息 | 学生思政最新消息 | 研究生思政消息公告 | 研究生奖助学金 | 研究生思政就业信息 | 本科生思政消息公告 | 本科生奖助学金 | 本科生就业信息 | 学术报告 | | 本系动态 | 科研通知 | 研究生教育最新消息 | 学生思政最新消息 | 研究生思政消息公告 | 研究生奖助学金 | 研究生思政就业信息 | 本科生思政消息公告 | 本科生奖助学金 | 本科生就业信息 | 学术报告 |
| -------- | -------- | ------------------ | ---------------- | ------------------ | -------------- | ------------------ | ------------------ | -------------- | -------------- | -------- | | -------- | -------- | ------------------ | ---------------- | ------------------ | -------------- | ------------------ | ------------------ | -------------- | -------------- | -------- |
@@ -985,6 +985,16 @@ https://rsshub.app/**nuist**/`bulletin` 或 https://rsshub.app/**nuist**/`bullet
</Route> </Route>
### 浙大软件学院
<Route author="yonvenne" example="/zju/cst/1" path="/zju/cst/:type" :paramsDesc="['分类, 见下表']">
| 全部通知 | 招生信息 | 教学管理 | 思政工作 | 实习就业 | 合作科研 |
| -------- | -------- | -------- | -------- | -------- | -------- |
| 0 | 1 | 2 | 3 | 4 | 5 |
</Route>
## 浙江工商大学 ## 浙江工商大学
### 浙江工商大学 ### 浙江工商大学

View File

@@ -1242,6 +1242,7 @@ router.get('/zju/list/:type', require('./routes/universities/zju/list'));
router.get('/zju/physics/:type', require('./routes/universities/zju/physics')); router.get('/zju/physics/:type', require('./routes/universities/zju/physics'));
router.get('/zju/grs/:type', require('./routes/universities/zju/grs')); router.get('/zju/grs/:type', require('./routes/universities/zju/grs'));
router.get('/zju/career/:type', require('./routes/universities/zju/career')); router.get('/zju/career/:type', require('./routes/universities/zju/career'));
router.get('/zju/cst/:type', require('./routes/universities/zju/cst'));
// Infoq // Infoq
router.get('/infoq/recommend', require('./routes/infoq/recommend')); router.get('/infoq/recommend', require('./routes/infoq/recommend'));

View File

@@ -0,0 +1,63 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const host = 'http://www.cst.zju.edu.cn/index.php?c=Index&a=tlist&catid=';
const map = new Map([
[1, { id: '2', title: '浙大软件学院-招生信息' }],
[2, { id: '3', title: '浙大软件学院-教学管理' }],
[3, { id: '4', title: '浙大软件学院-思政工作' }],
[4, { id: '6', title: '浙大软件学院-实习就业' }],
[5, { id: '7', title: '浙大软件学院-合作科研' }],
]);
async function getPage(id) {
const res = await got({
method: 'get',
url: host + `${id}`,
});
const $ = cheerio.load(res.data);
const list = $('.lm_new').find('li');
return (
list &&
list
.map((index, item) => {
item = $(item);
return {
title: item.find('a').text(),
pubDate: new Date(item.find('.fr').text()).toUTCString(),
link: `http://cst.zju.edu.cn/${item.find('a').attr('href')}`,
};
})
.get()
);
}
module.exports = async (ctx) => {
const type = Number.parseInt(ctx.params.type);
if (type === 0) {
const tasks = [];
for (const value of map.values()) {
tasks.push(getPage(value.id));
}
const results = await Promise.all(tasks);
let items = [];
results.forEach((result) => {
items = items.concat(result);
});
ctx.state.data = {
title: '浙大软件学院-全部通知',
link: host + 'NULL',
item: items,
};
} else {
const id = map.get(type).id;
ctx.state.data = {
title: map.get(type).title,
link: host + `${id}`,
item: await getPage(id),
};
}
};