feat(route): 添加中国无线电协会业余无线电分会考试信息路由 (#18903)

* feat(route): 添加中国无线电协会业余无线电分会考试信息路由

* feat(route): 添加中国无线电协会业余无线电分会考试信息路由
This commit is contained in:
圆头圆脑 2025-04-24 21:22:10 +08:00 committed by GitHub
parent 40109a7fc6
commit 8ca06ec337
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 56 additions and 0 deletions

56
lib/routes/crac/exam.ts Normal file
View File

@ -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,
};
}