From 8ca06ec337d4dbce846f6f7001ab43856e143a66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9C=86=E5=A4=B4=E5=9C=86=E8=84=91?= Date: Thu, 24 Apr 2025 21:22:10 +0800 Subject: [PATCH] =?UTF-8?q?feat(route):=20=E6=B7=BB=E5=8A=A0=E4=B8=AD?= =?UTF-8?q?=E5=9B=BD=E6=97=A0=E7=BA=BF=E7=94=B5=E5=8D=8F=E4=BC=9A=E4=B8=9A?= =?UTF-8?q?=E4=BD=99=E6=97=A0=E7=BA=BF=E7=94=B5=E5=88=86=E4=BC=9A=E8=80=83?= =?UTF-8?q?=E8=AF=95=E4=BF=A1=E6=81=AF=E8=B7=AF=E7=94=B1=20(#18903)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(route): 添加中国无线电协会业余无线电分会考试信息路由 * feat(route): 添加中国无线电协会业余无线电分会考试信息路由 --- lib/routes/crac/exam.ts | 56 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 lib/routes/crac/exam.ts diff --git a/lib/routes/crac/exam.ts b/lib/routes/crac/exam.ts new file mode 100644 index 000000000..084ddf088 --- /dev/null +++ b/lib/routes/crac/exam.ts @@ -0,0 +1,56 @@ +import { Route } from '@/types'; +import got from '@/utils/got'; + +export const route: Route = { + path: '/exam', + categories: ['government'], + example: '/crac/exam', + features: { + requireConfig: false, + requirePuppeteer: false, + antiCrawler: false, + supportBT: false, + supportPodcast: false, + supportScihub: false, + }, + name: '考试信息', + maintainers: ['admxj'], + handler, +}; + +async function handler() { + const baseUrl = 'http://82.157.138.16:8091/CRAC'; + + const response = await got({ + method: 'post', + url: `${baseUrl}/app/exam_advice/examAdviceList`, + body: { req: { type: '0', page_no: '1', page_size: '10' } }, + }); + + const list = response.data.res.list.map((item) => { + const id = Buffer.from(item.id).toString('base64'); + const type = Buffer.from(item.type).toString('base64'); + const link = `${baseUrl}/crac/pages/list_detail.html?id=${id}&type=${type}`; + return { + title: item.name, + link, + id: item.id, + author: item.exam.organizer, + pubDate: item.createDate, + updated: item.updateDate, + startDate: item.exam.signUpStartDate, + category: [item.examType], + image: item.weixin, + content: { + html: item.content, + }, + description: item.exam.signUpStartDate, + }; + }); + + return { + title: '考试信息-中国无线电协会业余无线电分会', + link: 'http://82.157.138.16:8091/CRAC/crac/pages/list_examMsg.html', + item: list, + }; +}