diff --git a/docs/finance.md b/docs/finance.md index 2703adb91..8aab0ac0a 100644 --- a/docs/finance.md +++ b/docs/finance.md @@ -30,11 +30,17 @@ pageClass: routes ### 电报 - + + +| 看盘 | 公告 | 解读 | 加红 | 推送 | 提醒 | 基金 | +| ----- | ------------ | ------- | ---- | ----- | ------ | ---- | +| watch | announcement | explain | red | jpush | remind | fund | + + ### 深度 - + | 要闻 | 股市 | 环球 | 公司 | 地产 | 券商 | 金融 | 汽车 | 科创版 | | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ------ | diff --git a/lib/router.js b/lib/router.js index 150c22b5a..3d9cd1c67 100644 --- a/lib/router.js +++ b/lib/router.js @@ -3021,9 +3021,8 @@ router.get('/gov/caict/caictgd', require('./routes/gov/caict/caictgd')); router.get('/cs/news/:caty', require('./routes/cs/news')); // 财联社 -router.get('/cls/telegraph', require('./routes/cls/telegraph')); -router.get('/cls/depth', require('./routes/cls/depth')); -router.get('/cls/depth/:caty', require('./routes/cls/depth')); +router.get('/cls/depth/:category?', require('./routes/cls/depth')); +router.get('/cls/telegraph/:category?', require('./routes/cls/telegraph')); // hentai-cosplays router.get('/hentai-cosplays/:type?/:name?', require('./routes/hentai-cosplays/hentai-cosplays')); diff --git a/lib/routes/cls/depth.js b/lib/routes/cls/depth.js index 3a90dbceb..8fbcfa631 100644 --- a/lib/routes/cls/depth.js +++ b/lib/routes/cls/depth.js @@ -14,13 +14,13 @@ const config = { }; module.exports = async (ctx) => { - ctx.params.caty = ctx.params.caty || '1000'; - const title = config[ctx.params.caty]; + ctx.params.category = ctx.params.category || '1000'; + const title = config[ctx.params.category]; if (!title) { throw Error('Bad category. See docs'); } - const link = `https://www.cls.cn/v3/depth/home/assembled/${ctx.params.caty}?app=CailianpressWeb&os=web&sv=7.2.2&sign=6ac194f4b3b39d45631708474e058b73`; + const link = `https://www.cls.cn/v3/depth/home/assembled/${ctx.params.category}?app=CailianpressWeb&os=web&sv=7.2.2&sign=6ac194f4b3b39d45631708474e058b73`; const response = await got({ method: 'get', url: link, diff --git a/lib/routes/cls/telegraph.js b/lib/routes/cls/telegraph.js index d1b6de771..8eb32880e 100644 --- a/lib/routes/cls/telegraph.js +++ b/lib/routes/cls/telegraph.js @@ -1,7 +1,19 @@ const got = require('@/utils/got'); +const titles = { + watch: '看盘', + announcement: '公告', + explain: '解读', + red: '加红', + jpush: '推送', + remind: '提醒', + fund: '基金', +}; + module.exports = async (ctx) => { - const link = `https://www.cls.cn/nodeapi/updateTelegraphList?rn=20`; + const category = ctx.params.category || ''; + + const link = `https://www.cls.cn/nodeapi/updateTelegraphList?app=CailianpressWeb&category=${category}&hasFirstVipArticle=1&rn=30`; const response = await got({ method: 'get', url: link, @@ -9,12 +21,13 @@ module.exports = async (ctx) => { const list = response.data.data.roll_data.map((item) => ({ title: item.title || item.content, + link: item.shareurl, description: item.content, pubDate: new Date(item.ctime * 1000).toUTCString(), })); ctx.state.data = { - title: `财联社 - 电报`, + title: `财联社 - 电报${category === '' ? '' : ` - ${titles[category]}`}`, link: 'https://www.cls.cn/telegraph', item: list, };