import{t as e}from"./cache-DUthuMSu.mjs";import{t}from"./got-BBDj7u1e.mjs";import n from"node:querystring";const r=`http://jw.scut.edu.cn`,i=r+`/dist/`;r+``,r+``,r+``;const a=e=>`${r}/zhinan/cms/article/view.do?type=posts&id=${e}`,o=e=>`${r}/dist/#/detail/index?id=${e}&type=notice`,s={all:{title:`全部`,tag:`0`},course:{title:`选课`,tag:`1`},exam:{title:`考试`,tag:`2`},practice:{title:`实践`,tag:`3`},communication:{title:`交流`,tag:`4`},teacher:{title:`教师`,tag:`5`},info:{title:`信息`,tag:`6`}},c=e=>{let t=e.getTimezoneOffset()/60;return new Date(e.getTime()-3600*1e3*(8+t))},l=e=>{let t=new Date(e);return t.setHours(8),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),c(t)},u=e=>!!e.link,d=e=>e.replaceAll(`src="/`,`src="${new URL(`.`,r).href}`).replaceAll(`href="/`,`href="${new URL(`.`,r).href}`),f=e=>{if(!e.success)throw Error(`article api error`)},p=e=>`<p>链接：<a href="${a(e)}">电脑版</a>&nbsp;|&nbsp;<a href="${o(e)}">手机版</a></p>`,m=e=>d(e.content)+p(e.id),h={path:`/jwc/notice/:category?`,categories:[`university`],example:`/scut/jwc/notice/all`,parameters:{category:"通知分类，默认为 `all`"},features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1},name:`教务处通知公告`,maintainers:[`imkero`],handler:g,description:`| 全部 | 选课   | 考试 | 实践     | 交流          | 教师    | 信息 |
| ---- | ------ | ---- | -------- | ------------- | ------- | ---- |
| all  | course | exam | practice | communication | teacher | info |`};async function g(r){let o=s[r.req.param(`category`)||`all`],c=await t({method:`post`,url:`http://jw.scut.edu.cn/zhinan/jw/api/v2/findInformNotice.do?${n.stringify({pageNo:1,pageSize:20,tag:o.tag})}`,headers:{Referer:i}});f(c.data);let d=c.data.data.list,p=await Promise.all(d.map(async r=>{let o=a(r.id),s=await e.get(o);if(s)return JSON.parse(s);let c=await t({method:`post`,url:`http://jw.scut.edu.cn/zhinan/jw/api/v2/getArticleInfo.do?${n.stringify({id:r.id,categoryType:``})}`,headers:{Referer:i}});f(c.data);let d=c.data.data;d.id=r.id;let p=null;u(d)||(p=m(d));let h={title:d.name,link:o,description:p,pubDate:l(d.createDate).toUTCString()};return e.set(o,JSON.stringify(h)),h}));return{title:`华南理工大学教务处通知公告 - `+o.title,link:`http://jw.scut.edu.cn/zhinan/cms/toPosts.do`,item:p}}export{h as route};