feat: add wtu route (#6766)
This commit is contained in:
parent
e91d9968a1
commit
8b7ac00eab
|
|
@ -1632,6 +1632,19 @@ type 列表:
|
|||
|
||||
</Route>
|
||||
|
||||
## 武汉纺织大学
|
||||
|
||||
### 信息门户公告
|
||||
|
||||
<Route author="SweetDumpling" example="/wtu/2" path="/wtu/:type"
|
||||
:paramsDesc="['公告类型, 详见表格']">
|
||||
|
||||
| 公告类型 | 通知公告 | 教务信息 | 科研动态 |
|
||||
| -------- | -------- | -------- | -------- |
|
||||
| 参数 | 1 | 2 | 3 |
|
||||
|
||||
</Route>
|
||||
|
||||
## 西安电子科技大学
|
||||
|
||||
### 教务处
|
||||
|
|
|
|||
|
|
@ -3905,4 +3905,7 @@ router.get('/thrillist/:tag?', require('./routes/thrillist/index'));
|
|||
// 丁香园
|
||||
router.get('/dxy/vaccine/:province?/:city?/:location?', require('./routes/dxy/vaccine'));
|
||||
|
||||
// Wtu
|
||||
router.get('/wtu/:type', require('./routes/universities/wtu'));
|
||||
|
||||
module.exports = router;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
const got = require('@/utils/got');
|
||||
|
||||
const apiUrl = 'http://ehall.wtu.edu.cn/wtu/api/queryBulletinListByConditional.do?pageNum=1&pageSize=8&columnId=';
|
||||
const listUrl = 'http://ehall.wtu.edu.cn/new/list.html?type=';
|
||||
const psgUrl = 'http://ehall.wtu.edu.cn/new/detail-word.html?';
|
||||
const map = new Map([
|
||||
[1, { title: '通知公告', type: '2', id: '1994a3b58bef4ee887e1efc19881decd' }],
|
||||
[2, { title: '教务信息', type: '5', id: '36d47fcd3e774f289adfef1d93138a9d' }],
|
||||
[3, { title: '科研动态', type: '3', id: '48e8abfb983b4e4486b69feacad1dc1b' }],
|
||||
]);
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const typein = Number.parseInt(ctx.params.type);
|
||||
const title = map.get(typein).title;
|
||||
const columnId = map.get(typein).id;
|
||||
const type = map.get(typein).type;
|
||||
const res = await got({
|
||||
method: 'get',
|
||||
url: apiUrl + `${columnId}`,
|
||||
});
|
||||
const res_json = res.data.bulletinList;
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${title} - 武汉纺织大学信息门户`,
|
||||
link: listUrl + `${type}`,
|
||||
description: `${title} - 武汉纺织大学信息门户`,
|
||||
item: res_json.map((item) => ({
|
||||
title: item.TITLE,
|
||||
description: item.TITLE,
|
||||
pubDate: new Date(item.CREATE_TIME).toUTCString(),
|
||||
link: psgUrl + `type=` + `${type}` + `?bulletinId=` + item.WID,
|
||||
})),
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue