Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(route): add swjtu recruitment info rss #11915

Merged
merged 3 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat(route): add swjtu recruitment info rss
  • Loading branch information
qizidog committed Feb 20, 2023
commit f75ab0fe20e074bd1f222bdb4f9acb03c4d89068
4 changes: 4 additions & 0 deletions docs/university.md
Original file line number Diff line number Diff line change
Expand Up @@ -3021,6 +3021,10 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS

## 西南交通大学

### 就业招聘信息

<Route author="qizidog" example="/swjtu/jyzpxx" path="/swjtu/jyzpxx"/>

### 交通运输与物流学院

#### 研究生通知
Expand Down
77 changes: 77 additions & 0 deletions lib/v2/swjtu/jyzpxx.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');

const rootURL = 'https://jiuye.swjtu.edu.cn/career/';

module.exports = async (ctx) => {
const resp = await got({
method: 'post',
url: `${rootURL}/zpxx/search/zpxx/1/30`,
});

const list = resp.data.data.list;

const items = await Promise.all(
list.map((item) => {
const key = `swjtu:zpxx: ${item.zpxxid}`;
return ctx.cache.tryGet(key, async () => {
const data = await got({
method: 'post',
url: `${rootURL}/zpxx/data/zpxx/${item.zpxxid}`,
});
const content = data.data.data;

// 工作岗位表
const job_info = [
`<div overflow-x="auto" width="20%">
<table border="1px" table-layout="fixed" width="100%">
<tr> <th>职位名称</th>
<th>职位月薪</th>
<th>工作地点</th>
<th>专业需求</th>
<th>应聘条件</th>
</tr>`,
];
if (content.zwxxList !== null) {
for (const job of content.zwxxList) {
job_info.push(`<tr>
<td width="50">${job.zwmc}</td>
<td width="50">${job.yxmc}/月</td>
<td width="50">${job.gzdz}</td>
<td width="70">${job.zyyqmc}</td>
<td width="125">${job.zwms}</td>
</tr>`);
}
}
job_info.push('</table></div>');
TonyRL marked this conversation as resolved.
Show resolved Hide resolved

return {
title: `${item.dwmc}(${item.xzyjmc})`,
pubDate: parseDate(String(item.fbrq)),
description: `
<p>招聘主题:${item.zpzt}</p>
<p>单位名称:${item.dwmc}</p>
<p>单位性质:${item.xzyjmc}</p>
<p>行业名称:${item.hyyjmc}(${item.hyejmc})</p>
<p>公司规模:${item.rsgmmc}</p>
<p>招聘职位:</p>
${job_info.join('')}
<p>工作地点:${item.szxmc} ${item.xxdz}</p>
<p>招聘截止日期:${item.zpjzrq}</p>
<p>简历投递邮箱:${item.jltdyx}</p>
<p>单位网站:${item.dwwz}</p>
${content.zpxxEditor}
`,
TonyRL marked this conversation as resolved.
Show resolved Hide resolved
link: `${rootURL}/zpxx/view/zpxx/${item.zpxxid}`,
};
});
})
);

ctx.state.data = {
title: '西南交大-就业招聘信息',
link: `${rootURL}/zpxx/zpxx`,
qizidog marked this conversation as resolved.
Show resolved Hide resolved
item: items,
allowEmpty: true,
};
};
1 change: 1 addition & 0 deletions lib/v2/swjtu/maintainer.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = {
'/jtys/yjs': ['qizidog'],
'/jyzpxx': ['qizidog'],
};
8 changes: 8 additions & 0 deletions lib/v2/swjtu/radar.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,13 @@ module.exports = {
target: (_, url) => (new URL(url).searchParams.get('setAction') === 'newsList' && new URL(url).searchParams.get('bigTypeId') === '0E4BF4D36E232918' ? '/swjtu/jtys/yjs' : null),
},
],
jiuye: [
{
title: '就业招聘信息',
docs: 'https://docs.rsshub.app/university.html#xi-nan-jiao-tong-da-xue',
source: ['/career', '/'],
target: '/swjtu/jyzpxx',
},
],
},
};
1 change: 1 addition & 0 deletions lib/v2/swjtu/router.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = function (router) {
router.get('/jtys/yjs', require('./jtys/yjs'));
router.get('/jyzpxx', require('./jyzpxx'));
};