diff --git a/docs/university.md b/docs/university.md
index 4d1740ddf9..c93e6e6a6b 100644
--- a/docs/university.md
+++ b/docs/university.md
@@ -1930,6 +1930,10 @@ type 列表:
## 中国地质大学 (武汉)
+### 今日文章-包含全校网站最新通知
+
+
+
### 研究生院综合通知公告
@@ -1942,6 +1946,14 @@ type 列表:
+### 工程学院
+
+
+
+| 所有 | 学院新闻 | 通知公告 | 党建工作 | 学术动态 | 本科生教育 | 研究生教育 | 教工之家 |
+| -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
+| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
+
## 中国海洋大学
### 信息科学与工程学院
diff --git a/lib/router.js b/lib/router.js
index b146d36ee8..1cd5df7d77 100644
--- a/lib/router.js
+++ b/lib/router.js
@@ -2171,10 +2171,12 @@ router.get('/chuiniu/column_list', require('./routes/chuiniu/column_list'));
// leemeng
router.get('/leemeng', require('./routes/blogs/leemeng'));
-// 中国地质大学
-router.get('/cug/graduate', require('./routes/cug/graduate'));
-router.get('/cug/undergraduate', require('./routes/cug/undergraduate'));
-router.get('/cug/xgxy', require('./routes/cug/xgxy'));
+// 中国地质大学(武汉)
+router.get('/cug/graduate', require('./routes/universities/cug/graduate'));
+router.get('/cug/undergraduate', require('./routes/universities/cug/undergraduate'));
+router.get('/cug/xgxy', require('./routes/universities/cug/xgxy'));
+router.get('/cug/news', require('./routes/universities/cug/news'));
+router.get('/cug/gcxy/:type?', require('./routes/universities/cug/gcxy/index'));
// 网易 - 网易号
router.get('/netease/dy/:id', require('./routes/netease/dy'));
diff --git a/lib/routes/universities/cug/gcxy/index.js b/lib/routes/universities/cug/gcxy/index.js
new file mode 100644
index 0000000000..49b2503a2d
--- /dev/null
+++ b/lib/routes/universities/cug/gcxy/index.js
@@ -0,0 +1,113 @@
+const got = require('@/utils/got');
+const cheerio = require('cheerio');
+
+module.exports = async (ctx) => {
+ const host = 'http://gcxy.cug.edu.cn';
+
+ const typeUrl = [
+ {
+ name: '所有',
+ url: ''
+ },
+ {
+ name: '学院新闻',
+ url: '/index/xyxw.htm'
+ },
+ {
+ name: '通知公告',
+ url: '/index/tzgg.htm'
+ },
+ {
+ name: '党建工作',
+ url: '/index/djgz.htm'
+ },
+ {
+ name: '学术动态',
+ url: '/index/xsdt.htm'
+ },
+ {
+ name: '本科生教育',
+ url: '/index/bksjy.htm'
+ },
+ {
+ name: '研究生教育',
+ url: '/index/yjsjy.htm'
+ },
+ {
+ name: '教工之家',
+ url: '/index/jgzj.htm'
+ }
+ ];
+
+ let type = ctx.params && ctx.params.type;
+ if (type === undefined) {
+ type = 0;
+ } else {
+ type = Number(type);
+ if (type >= typeUrl.length) {
+ return false;
+ }
+ }
+
+ let typeList = [];
+
+ if (type === 0) {
+ // 获取所有的
+ typeList = Object.keys(Array.apply(null, { length: typeUrl.length }));
+ } else {
+ typeList.push(type);
+ }
+
+ // console.log(typeList);
+
+ const getItems = async function (url) {
+ try {
+ const response = await got({
+ method: 'get',
+ url: host + url,
+ headers: {
+ Referer: host,
+ },
+ });
+ const $ = cheerio.load(response.data);
+ const items = $('div.right_list > ul > li');
+ return await Promise.all(
+ items.map(async (index, item) => {
+ item = $(item);
+ const a = item.find('a');
+ const link = host + a.attr('href').replace('..', '');
+ // console.log(link);
+ return {
+ title: a.attr('title'),
+ link: link,
+ description: await got({
+ method: 'get',
+ url: link,
+ headers: {
+ Referer: host,
+ },
+ }).then((res) => {
+ const $ = cheerio.load(res.data);
+ return $('.v_news_content').html();
+ }).catch(() => ''),
+ pubDate: item.find('span').text(),
+ };
+ }).get()
+ );
+ } catch (e) {
+ return [];
+ }
+ };
+
+ const outList = await Promise.all(
+ typeList
+ .map(async (t) => await getItems(typeUrl[t].url))
+ );
+
+ ctx.state.data = {
+ title: '[' + typeUrl[type].name + ']' + 'CUG-工程学院',
+ link: host + typeUrl[type].url,
+ description: '中国地质大学(武汉)工程学院-' + typeUrl[type].name,
+ item: outList.reduce((p, n) => p.concat(n))
+ };
+};
diff --git a/lib/routes/cug/graduate.js b/lib/routes/universities/cug/graduate.js
similarity index 100%
rename from lib/routes/cug/graduate.js
rename to lib/routes/universities/cug/graduate.js
diff --git a/lib/routes/universities/cug/news.js b/lib/routes/universities/cug/news.js
new file mode 100644
index 0000000000..29023ef8df
--- /dev/null
+++ b/lib/routes/universities/cug/news.js
@@ -0,0 +1,64 @@
+const cheerio = require('cheerio');
+const got = require('@/utils/got');
+
+module.exports = async (ctx) => {
+ // 发起 HTTP GET 请求
+
+ const host = 'http://xxhb.cug.edu.cn/zqxt/zqjsjg.jsp?wbtreeid=1283&selectType=1&searchScope=0';
+
+ const response = await got({
+ method: 'get',
+ url: host,
+ });
+
+ const data = response.data;
+
+ const $ = cheerio.load(data);
+ const list = $('form[id=searchlistform1] > table.listFrame > tbody > tr > td');
+ const results = [];
+ let item = {};
+ for (let i = 0; i < list.length; i++) {
+ const d = $(list[i]);
+ d.find('i').remove();
+ const title = d.find('span.titlefontstyle206274');
+ const from = d.find('span.sourcesitefontstyle206274');
+ const description = d.find('span.contentfontstyle206274');
+ const time = d.find('span.timefontstyle206274');
+
+ if (title.length) {
+ item.title = from.text() + title.text();
+ item.link = d.find('a').attr('href');
+ } else if (description.length) {
+ item.description = item.description ? item.description + d.text() : d.text();
+ } else if (time.length) {
+ item.pubDate = new Date(time.text().replace('发表时间:', '').replace('年', '-').replace('月', '-').replace('日', '')).toUTCString();
+ results.push(item);
+ item = {};
+ }
+ }
+
+ let out = await Promise.all(
+ results
+ .map(async (element) => {
+ const link = element.link;
+ try {
+ const result = await got.get(link);
+ const $ = cheerio.load(result.data);
+ element.description = $('.v_news_content').html();
+ element.enabled = true;
+ } catch (e) {
+ element.enabled = false;
+ }
+ return Promise.resolve(element);
+ })
+ );
+
+ out = out.filter((item) => item.enabled === true);
+
+ ctx.state.data = {
+ title: 'CUG-今日文章',
+ link: host,
+ description: '中国地质大学(武汉) 每日文章,几乎包含全校站点最新信息。',
+ item: out,
+ };
+};
diff --git a/lib/routes/cug/undergraduate.js b/lib/routes/universities/cug/undergraduate.js
similarity index 100%
rename from lib/routes/cug/undergraduate.js
rename to lib/routes/universities/cug/undergraduate.js
diff --git a/lib/routes/cug/xgxy.js b/lib/routes/universities/cug/xgxy.js
similarity index 100%
rename from lib/routes/cug/xgxy.js
rename to lib/routes/universities/cug/xgxy.js