增加:东莞理工学院 (#945)

* 增加 东莞理工学院教务处通知
* 增加 东莞理工学院学生处通知
This commit is contained in:
AnyMoe
2018-10-24 00:02:32 +08:00
committed by DIYgod
parent b38201a63a
commit c2c812955e
4 changed files with 145 additions and 0 deletions
+18
View File
@@ -1311,6 +1311,24 @@ category 列表:
<route name="教务处信息" author="SettingDust" example="/dlu/jiaowu/news" path="/universities/dlu/jiaowu/news">
</route>
### 东莞理工学院
<route name="教务处通知" author="AnyMoe" example="/dgut/jwc/" path="/universities/dgut/jwc/:type?" :paramsDesc="['默认为 `2`']">
| 教务公告 | 教学信息 |
| -------- | -------- |
| 1 | 2 |
</route>
<route name="学工部动态" author="AnyMoe" example="/dgut/xsc/" path="/universities/dgut/xsc/:type?" :paramsDesc="['默认为 `2`']">
| 学工动态 | 通知公告 | 网上公示 |
| -------- | -------- | -------- |
| 1 | 2 | 4 |
</route>
## 传统媒体
### 央视新闻
+4
View File
@@ -586,6 +586,10 @@ router.get('/sdu/epe/:type?', require('./routes/universities/sdu/epe'));
// 大连大学
router.get('/dlu/jiaowu/news', require('./routes/universities/dlu/jiaowu/news'));
// 东莞理工学院
router.get('/dgut/jwc/:type?', require('./routes/universities/dgut/jwc'));
router.get('/dgut/xsc/:type?', require('./routes/universities/dgut/xsc'));
// ifanr
router.get('/ifanr/:channel?', require('./routes/ifanr/index'));
+62
View File
@@ -0,0 +1,62 @@
const axios = require('../../../utils/axios');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const base_host = 'http://jwc.dgut.edu.cn/';
const host = base_host + 'dglgjwc/';
const name = '教务处';
let type = ctx.params.type;
let info, url_type;
switch (type) {
case '1':
info = '教务公告';
url_type = 'jwgg';
break;
case '2':
info = '教学信息';
url_type = 'jxxx';
break;
default:
info = '教学信息';
url_type = 'jxxx';
}
const response = await axios({
method: 'get',
url: host + url_type + '/list.shtml',
headers: {
Referer: base_host,
},
});
const $ = cheerio.load(response.data);
const text = $('div.con-right').find('div.list_div');
ctx.state.data = {
title: `东莞理工学院 ${name} ${info}`,
link: host + url_type + '/list.shtml',
description: `东莞理工学院 ${name} ${info}`,
item:
text &&
text
.map((index, item) => {
item = $(item);
return {
title: item.find('a').text(),
description: item.find('a').text(),
category: item.find('.column-name').text(),
pubDate: $('td[align="left"]', item)
.slice(5)
.text()
.trim(),
link:
host +
item
.find('a')
.attr('href')
.slice(1),
};
})
.get(),
};
};
+61
View File
@@ -0,0 +1,61 @@
const axios = require('../../../utils/axios');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const host = 'http://xsc.dgut.edu.cn/';
const name = '学生工作部(学生处)';
let type = ctx.params.type;
let info, url_type;
switch (type) {
case '1':
info = '学工动态';
url_type = 'bgfw/xgdt';
break;
case '2':
info = '通知公告';
url_type = 'bgfw/tzgg';
break;
case '4':
info = '网上公示';
url_type = 'bgfw/wsgs';
break;
default:
info = '通知公告';
url_type = 'bgfw/tzgg';
}
const response = await axios({
method: 'get',
url: host + url_type + '/',
headers: {
Referer: host,
},
});
const $ = cheerio.load(response.data);
const text = $('#paging > ul').find('li');
ctx.state.data = {
title: `东莞理工学院 ${name} ${info}`,
link: host + url_type + '/index.shtml',
description: `东莞理工学院 ${name} ${info}`,
item:
text &&
text
.map((index, item) => {
item = $(item);
return {
title: item.find('a').attr('title'),
description: item.find('a').text(),
pubDate: item.find('.time').text(),
link:
host +
item
.find('a')
.attr('href')
.slice(1),
};
})
.get(),
};
};