feat: add 郑州轻工业大学 (#5232)

Co-authored-by: codefactor-io <support@codefactor.io>
This commit is contained in:
Chenglin Wu 2020-07-28 23:31:35 +08:00 committed by GitHub
parent d7e758aa00
commit 2f26dc545e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 112 additions and 0 deletions

View File

@ -1680,6 +1680,28 @@ type 列表:
</Route>
## 郑州轻工业大学
### 智慧门户
<Route author="Fantasia1999" example="/zzuli/campus/0" path="/zzuli/campus/:type" :paramsDesc="['分类, 见下表']" radar="1">
| 参数名称 | 公告信息 | 学工信息 | 教学信息 | 信息快递 | 学术报告 | 科研信息 | 网络公告 | 班车查询 | 周会表 |
| -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| 参数 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
</Route>
### 研究生处
<Route author="Fantasia1999" example="/zzuli/yjsc/0" path="/zzuli/yjsc/:type" :paramsDesc="['分类, 见下表']" radar="1">
| 参数名称 | 公告通知 | 招生工作 | 新闻资讯 | 培养工作 | 学位工作 |
| -------- | -------- | -------- | -------- | -------- | -------- |
| 参数 | 0 | 1 | 2 | 3 | 4 |
</Route>
## 中北大学
### 各种新闻通知

View File

@ -690,6 +690,10 @@ router.get('/cuit/cxxww/:type?', require('./routes/universities/cuit/cxxww'));
router.get('/zzu/news/:type', require('./routes/universities/zzu/news'));
router.get('/zzu/soft/news/:type', require('./routes/universities/zzu/soft/news'));
// 郑州轻工业大学
router.get('/zzuli/campus/:type', require('./routes/universities/zzuli/campus'));
router.get('/zzuli/yjsc/:type', require('./routes/universities/zzuli/yjsc'));
// 重庆科技学院
router.get('/cqust/jw/:type?', require('./routes/universities/cqust/jw'));
router.get('/cqust/lib/:type?', require('./routes/universities/cqust/lib'));

View File

@ -0,0 +1,45 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const map = new Map([
[0, { title: '公告信息', link: 'http://info.zzuli.edu.cn/_t961/2464/list.htm' }],
[1, { title: '学工信息', link: 'http://info.zzuli.edu.cn/_t961/xsxx/list.htm' }],
[2, { title: '教学信息', link: 'http://info.zzuli.edu.cn/_t961/jwxx/list.htm' }],
[3, { title: '信息快递', link: 'http://info.zzuli.edu.cn/_t961/2536/list.htm' }],
[4, { title: '学术报告', link: 'http://info.zzuli.edu.cn/_t961/xsbg/list.htm' }],
[5, { title: '科研信息', link: 'http://info.zzuli.edu.cn/_t961/kyxx/list.htm' }],
[6, { title: '网络公告', link: 'http://info.zzuli.edu.cn/_s19/_t960/wlgg/list.psp' }],
[7, { title: '班车查询', link: 'http://info.zzuli.edu.cn/_s19/_t960/2619/list.htm' }],
[8, { title: '周会表', link: 'http://info.zzuli.edu.cn/_s19/_t960/bzhy/list.psp' }],
]);
module.exports = async (ctx) => {
const type = Number.parseInt(ctx.params.type);
const id = map.get(type).link;
const res = await got({
method: 'get',
url: `${id}`,
responseType: 'buffer',
});
const $ = cheerio.load(res.data);
const list = $('.lists tr').slice(0, 10);
const items =
list &&
list
.map((index, item) => {
item = $(item);
return {
title: item.find('td a').attr('title'),
link: item.find('td a').attr('href'),
pubDate: new Date(item.find('td div').text()),
};
})
.get();
ctx.state.data = {
title: map.get(type).title + ' - 郑州轻工业大学智慧门户',
link: map.get(type).link,
item: items,
};
};

View File

@ -0,0 +1,41 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const map = new Map([
[0, { title: '公告通知', link: 'http://yjsc.zzuli.edu.cn/ggtz/list.htm' }],
[1, { title: '招生工作', link: 'http://yjsc.zzuli.edu.cn/2878/list.htm' }],
[2, { title: '新闻资讯', link: 'http://yjsc.zzuli.edu.cn/2918/list.htm' }],
[3, { title: '培养工作', link: 'http://yjsc.zzuli.edu.cn/2882/list.htm' }],
[4, { title: '学位工作', link: 'http://yjsc.zzuli.edu.cn/2890/list.htm' }],
]);
module.exports = async (ctx) => {
const type = Number.parseInt(ctx.params.type);
const id = map.get(type).link;
const res = await got({
method: 'get',
url: `${id}`,
responseType: 'buffer',
});
const $ = cheerio.load(res.data);
const list = $('div table tbody tr td table tbody tr').slice(0, 10);
const items =
list &&
list
.map((index, item) => {
item = $(item);
return {
title: item.find('td a').attr('title'),
link: item.find('td a').attr('href'),
pubDate: new Date(item.find('td div').text()),
};
})
.get();
ctx.state.data = {
title: map.get(type).title + ' - 郑州轻工业大学研究生处',
link: map.get(type).link,
item: items,
};
};