Files
RSSHub/lib/v2/sse/renewal.js
Tony 5c50f81bcf fix(route): sse (#10779)
* fix(route): sse

* refactor: migrate to v2 cont

* docs: fix example

* fix: typo

* docs: fix tag
2022-09-14 03:27:16 +08:00

58 lines
2.1 KiB
JavaScript

const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');
const { art } = require('@/utils/render');
const path = require('path');
const dayjs = require('dayjs');
const localizedFormat = require('dayjs/plugin/localizedFormat');
require('dayjs/locale/zh-cn');
dayjs.extend(localizedFormat);
const currStatusName = ['全部', '已受理', '已询问', '通过', '未通过', '提交注册', '补充审核', '注册结果', '中止', '终止'];
module.exports = async (ctx) => {
const pageUrl = 'https://kcb.sse.com.cn/renewal/';
const host = `https://kcb.sse.com.cn`;
const response = await got('https://query.sse.com.cn/statusAction.do', {
searchParams: {
isPagination: true,
sqlId: 'SH_XM_LB',
'pageHelp.pageSize': 20,
offerType: '',
commitiResult: '',
registeResult: '',
province: '',
csrcCode: '',
currStatus: '',
order: 'updateDate|desc,stockAuditNum|desc',
keyword: '',
auditApplyDateBegin: '',
auditApplyDateEnd: '',
_: new Date().getTime(),
},
headers: {
Referer: pageUrl,
},
});
// console.log(response.data.result);
const items = response.data.result.map((item) => ({
title: `${currStatusName[item.currStatus]}${item.stockAuditName}`,
description: art(path.resolve(__dirname, 'templates/renewal.art'), {
item,
currStatus: currStatusName[item.currStatus],
updateDate: dayjs(item.updateDate, 'YYYYMMDDHHmmss').locale('zh-cn').format('lll'),
auditApplyDate: dayjs(item.auditApplyDate, 'YYYYMMDDHHmmss').locale('zh-cn').format('lll'),
}),
pubDate: parseDate(item.updateDate, 'YYYYMMDDHHmmss'),
link: `${host}/renewal/xmxq/index.shtml?auditId=${item.stockAuditNum}`,
author: item.stockAuditName,
}));
ctx.state.data = {
title: '上海证券交易所 - 科创板项目动态',
link: pageUrl,
item: items,
};
};