diff --git a/docs/other.md b/docs/other.md index 42534e656e..6e83bd8b07 100644 --- a/docs/other.md +++ b/docs/other.md @@ -855,6 +855,12 @@ type 为 all 时,category 参数不支持 cost 和 free +## 上证债券信息网 + +### 可转换公司债券公告 + + + ## 少数派 sspai ### 最新上架付费专栏 diff --git a/lib/router.js b/lib/router.js index fa2d569ff7..bbbedbcbcc 100644 --- a/lib/router.js +++ b/lib/router.js @@ -1634,4 +1634,7 @@ router.get('/queshu/book/:bookid', require('./routes/queshu/book')); // LaTeX 开源小屋 router.get('/latexstudio/home', require('./routes/latexstudio/home')); +// 上证债券信息网 - 可转换公司债券公告 +router.get('/sse/convert/:query?', require('./routes/sse/convert')); + module.exports = router; diff --git a/lib/routes/sse/convert.js b/lib/routes/sse/convert.js new file mode 100644 index 0000000000..01eb5c2f09 --- /dev/null +++ b/lib/routes/sse/convert.js @@ -0,0 +1,32 @@ +const got = require('@/utils/got'); + +module.exports = async (ctx) => { + const query = ctx.params.query || ''; // beginDate=2018-08-18&endDate=2019-08-18&companyCode=603283&title=股份 + const pageUrl = 'http://bond.sse.com.cn/disclosure/announ/convertible/#'; + const host = `http://www.sse.com.cn`; + + const response = await got({ + method: 'get', + url: `http://query.sse.com.cn/infodisplay/queryBulletinKzzTipsNew.do?isPagination=true&pageHelp.pageSize=2&flag=0&_=${new Date().getTime()}&${query.replace(/([\u4e00-\u9fa5])/g, (str) => encodeURIComponent(str))}`, + headers: { + Referer: pageUrl, + }, + }); + + const items = response.data.result.map((item) => { + const single = { + title: item.title, + description: `${host}${item.URL}`, + pubDate: new Date(item.SSEDate).toUTCString(), + link: `${host}${item.URL}`, + author: item.security_Code, + }; + return single; + }); + + ctx.state.data = { + title: '上证债券信息网 - 可转换公司债券公告', + link: pageUrl, + item: items, + }; +};