UNPKG

rsshub

Version:
86 lines (83 loc) 3.3 kB
import { n as init_esm_shims, t as __dirname } from "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import "./ofetch-BIyrKU3Y.mjs"; import { t as parseDate } from "./parse-date-BrP7mxXf.mjs"; import { t as cache_default } from "./cache-Bo__VnGm.mjs"; import "./helpers-DxBp0Pty.mjs"; import { t as art } from "./render-BQo6B4tL.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; import { t as timezone } from "./timezone-D8cuwzTY.mjs"; import path from "node:path"; //#region lib/routes/xjtu/job.ts init_esm_shims(); const baseUrl = "https://job.xjtu.edu.cn"; const arr = { zxgg: "中心公告", xds: "选调生", zddw: "重点单位", gjzz: "国际组织", cxcy: "创新创业", jysx: "就业实习" }; const route = { path: "/job/:subpath?", categories: ["university"], example: "/xjtu/job/zxgg", parameters: { subpath: "栏目类型,默认请求`zxgg`,详见下方表格" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, name: "就业创业中心", maintainers: ["DylanXie123"], handler, description: `栏目类型 | 中心公告 | 选调生 | 重点单位 | 国际组织 | 创新创业 | 就业实习 | | -------- | ------ | -------- | -------- | -------- | -------- | | zxgg | xds | zddw | gjzz | cxcy | jysx |` }; async function handler(ctx) { const subpath = ctx.req.param("subpath") ?? "zxgg"; const menuid = (await got_default.post(`${baseUrl}/xsfw/sys/jyxtgktapp/modules/jywzManage/getTzgg.do`, { form: { requestParamStr: "{\"pageSize\":7,\"pageNumber\":1}" }, https: { rejectUnauthorized: false } })).data.data.find((item) => item.menutitle === arr[subpath]).menuid; const { data } = await got_default.post(`${baseUrl}/xsfw/sys/jyxtgktapp/modules/jywzManage/getMhcxWzData.do`, { form: { requestParamStr: `{"pageSize":4,"pageNumber":1,"LMDM":${menuid}}` }, https: { rejectUnauthorized: false } }); const list = data.data.map((item) => ({ title: item.menutitle, description: item.NR, pubDate: timezone(parseDate(item.SBSJ), 8), guid: item.menuid, link: `${baseUrl}/xsfw/sys/emaphome/website/template/detail.html?menuid=${item.menuid}&msg=TZGG&msgChild=NRXQ` })); const items = await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { const response = await got_default.post(`${baseUrl}/xsfw/sys/jyxtgktapp/modules/jywzManage/getWzone.do`, { form: { requestParamStr: `{"WID":${item.guid}}` }, https: { rejectUnauthorized: false } }); let attachments = ""; if (response.data.data[0].FJ) { const attachmentData = await got_default(`${baseUrl}/xsfw/sys/emapcomponent/file/getUploadedAttachment.do?fileToken=${response.data.data[0].FJ}`, { https: { rejectUnauthorized: false } }); attachments = art(path.join(__dirname, "templates/attachments-e22262eb.art"), { items: attachmentData.data.items }); } item.author = response.data.data[0].CZZXM; item.description = response.data.data[0].NR + attachments; return item; }))); return { title: `西安交通大学学生就业创业信息网 - ${arr[subpath]}`, link: baseUrl, item: items }; } //#endregion export { route };