增加理工大教务处,财务处和研究生网站的分通知 (#922)
This commit is contained in:
parent
a33e29b6d5
commit
0b27a56241
|
|
@ -1175,7 +1175,11 @@ category 列表:
|
|||
|
||||
### 南京理工大学
|
||||
|
||||
<route name="南京理工大学教务处通知" author="MilkShakeYoung" example="/njust/jwc" path="/universities/njust/jwc"/>
|
||||
<route name="南京理工大学教务处" author="MilkShakeYoung" example="/njust/jwc/1" path="/universities/njust/jwc/:type" :paramsDesc="['1 为教师通知, 2 为学生通知, 3 为新闻,4 为学院动态']"/>
|
||||
|
||||
<route name="南京理工大学财务处" author="MilkShakeYoung" example="/njust/cwc/1" path="/universities/njust/cwc/:type" :paramsDesc="['1 新闻及通知, 2 办事指南']"/>
|
||||
|
||||
<route name="南京理工大学研究生院" author="MilkShakeYoung" example="/njust/gs/2" path="/universities/njust/gs/:type" :paramsDesc="['1 博闻讲堂, 2 学术公告']"/>
|
||||
|
||||
### 四川旅游学院
|
||||
|
||||
|
|
|
|||
|
|
@ -548,7 +548,9 @@ router.get('/cczu/jwc/:category?', require('./routes/universities/cczu/jwc'));
|
|||
router.get('/cczu/news/:category?', require('./routes/universities/cczu/news'));
|
||||
|
||||
// 南京理工大学
|
||||
router.get('/njust', require('./routes/universities/njust/jwc'));
|
||||
router.get('/njust/jwc/:type', require('./routes/universities/njust/jwc'));
|
||||
router.get('/njust/cwc/:type', require('./routes/universities/njust/cwc'));
|
||||
router.get('/njust/gs/:type', require('./routes/universities/njust/gs'));
|
||||
|
||||
// 四川旅游学院
|
||||
router.get('/sctu/xgxy', require('./routes/universities/sctu/xgxy'));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
const axios = require('../../../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
const url = require('url');
|
||||
|
||||
const host = 'http://cwc.njust.edu.cn/';
|
||||
|
||||
const map = new Map([[1, { title: '南京理工大学财务处 -- 新闻及通知', id: 'wp_news_w2' }], [2, { title: '南京理工大学财务处 -- 办事指南', id: 'wp_news_w3' }]]);
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = Number.parseInt(ctx.params.type);
|
||||
const response = await axios.get(host);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const id = map.get(type).id;
|
||||
|
||||
const items = $(`#${id} tr tr`)
|
||||
.map((_, elem) => {
|
||||
const a = $('td:first-child > a', elem);
|
||||
return {
|
||||
link: url.resolve(host, a.attr('href')),
|
||||
title: a.attr('title'),
|
||||
pubDate: new Date($('td:nth-child(2)', elem).text()).toUTCString(),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
link: host,
|
||||
title: map.get(type).title,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
const axios = require('../../../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const map = new Map([[1, { title: '南京理工大学研究生院 -- 博闻讲堂', id: '/sytzgg_4568' }], [2, { title: '南京理工大学研究生院 -- 学术公告', id: '/xshdggl' }]]);
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = Number.parseInt(ctx.params.type);
|
||||
const id = map.get(type).id;
|
||||
const baseURL = 'http://gs.njust.edu.cn';
|
||||
const res = await axios({
|
||||
method: 'get',
|
||||
url: baseURL + id + '/list.htm',
|
||||
headers: {
|
||||
Referer: 'https://gs.njust.edu.cn/',
|
||||
},
|
||||
});
|
||||
const data = res.data;
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('.wp_article_list li');
|
||||
|
||||
ctx.state.data = {
|
||||
title: '南京理工大学研究生网站',
|
||||
link: 'https://gs.njust.edu.cn',
|
||||
// description: '',
|
||||
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
|
||||
return {
|
||||
title: item.find('a').text(),
|
||||
link: `${baseURL + $(item.find('a')).attr('href')}`,
|
||||
pubDate: new Date(item.find('Article_PublishDate').text()).toUTCString(),
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
const axios = require('../../../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
const url = require('url');
|
||||
|
||||
const host = 'http://jwc.njust.edu.cn/';
|
||||
|
||||
const map = new Map([
|
||||
[1, { title: '南京理工大学教务处 -- 教师通知', id: 'wp_news_w12' }],
|
||||
[2, { title: '南京理工大学教务处 -- 学生通知', id: 'wp_news_w13' }],
|
||||
[3, { title: '南京理工大学教务处 -- 新闻', id: 'wp_news_w14' }],
|
||||
[4, { title: '南京理工大学教务处 -- 学院动态', id: 'wp_news_w15' }],
|
||||
]);
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = Number.parseInt(ctx.params.type);
|
||||
const response = await axios.get(host);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const id = map.get(type).id;
|
||||
|
||||
const items = $(`#${id} tr tr`)
|
||||
.map((_, elem) => {
|
||||
const a = $('td:first-child > a', elem);
|
||||
return {
|
||||
link: url.resolve(host, a.attr('href')),
|
||||
title: a.attr('title'),
|
||||
pubDate: new Date($('td:nth-child(2)', elem).text()).toUTCString(),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
link: host,
|
||||
title: map.get(type).title,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue