fix(route): 加美财经 Cache key must be a string (#13134)
* fix(route): 加美财经 Cache key must be a string * refactor: migrate to v2 ---------
This commit is contained in:
parent
686df84294
commit
cebf7e285a
|
|
@ -2576,7 +2576,7 @@ router.get('/macau-bolsas/:lang?', lazyloadRouteHandler('./routes/macau-bolsas/i
|
|||
router.get('/potplayer/update/:language?', lazyloadRouteHandler('./routes/potplayer/update'));
|
||||
|
||||
// 加美财经
|
||||
router.get('/caus/:category?', lazyloadRouteHandler('./routes/caus'));
|
||||
// router.get('/caus/:category?', lazyloadRouteHandler('./routes/caus'));
|
||||
|
||||
// 摩点
|
||||
router.get('/modian/zhongchou/:category?/:sort?/:status?', lazyloadRouteHandler('./routes/modian/zhongchou'));
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@ const categories = {
|
|||
title: '快讯',
|
||||
link: 'hours?id=3',
|
||||
},
|
||||
4: {
|
||||
title: '投资理财',
|
||||
link: 'CFT?id=4',
|
||||
8: {
|
||||
title: '财富',
|
||||
link: 'fortune?id=8',
|
||||
},
|
||||
6: {
|
||||
title: '生活',
|
||||
|
|
@ -59,8 +59,10 @@ module.exports = async (ctx) => {
|
|||
|
||||
const list = (isHome ? response.data.data : response.data.data.articleList).map((item) => ({
|
||||
title: item.title,
|
||||
link: item.contentId,
|
||||
link: `${rootUrl}/detail/${item.contentId}`,
|
||||
contentId: item.contentId,
|
||||
pubDate: new Date(item.createTime),
|
||||
category: [...new Set([...item.lanmus.map((lanmu) => lanmu.name), ...item.tags.map((tag) => tag.name)])],
|
||||
}));
|
||||
|
||||
const items = await Promise.all(
|
||||
|
|
@ -68,10 +70,9 @@ module.exports = async (ctx) => {
|
|||
ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got({
|
||||
method: 'get',
|
||||
url: `${apiRootUrl}/toronto/display/contentWithRelate?contentId=${item.link}`,
|
||||
url: `${apiRootUrl}/toronto/display/contentWithRelate?contentId=${item.contentId}`,
|
||||
});
|
||||
|
||||
item.link = `${rootUrl}/detail/${item.link}`;
|
||||
item.description = detailResponse.data.data.content.content;
|
||||
|
||||
return item;
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/:category?': ['nczitzk'],
|
||||
};
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
module.exports = {
|
||||
'caus.com': {
|
||||
_name: '加美财经',
|
||||
'.': [
|
||||
{
|
||||
title: '分类',
|
||||
docs: 'https://docs.rsshub.app/routes/new-media#jia-mei-cai-jing',
|
||||
source: ['/home', '/focus_news', '/hours', '/fortune', '/life'],
|
||||
target: (_, url) => `/caus/${new URL(url).searchParams.get('id')}`,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = (router) => {
|
||||
router.get('/:category?', require('./index'));
|
||||
};
|
||||
|
|
@ -3011,11 +3011,13 @@ others = 热点新闻 + 滚动新闻
|
|||
|
||||
## 加美财经 {#jia-mei-cai-jing}
|
||||
|
||||
<Route author="nczitzk" example="/caus" path="/caus/:category?" paramsDesc={['分类,见下表,默认为全部']}>
|
||||
### 分类 {#jia-mei-cai-jing-fen-lei}
|
||||
|
||||
| 全部 | 要闻 | 商业 | 快讯 | 投资理财 | 生活 |
|
||||
<Route author="nczitzk" example="/caus" path="/caus/:category?" paramsDesc={['分类,见下表,默认为全部']} radar="1">
|
||||
|
||||
| 全部 | 要闻 | 商业 | 快讯 | 财富 | 生活 |
|
||||
| ---- | ---- | ---- | ---- | -------- | ---- |
|
||||
| 0 | 1 | 2 | 3 | 4 | 6 |
|
||||
| 0 | 1 | 2 | 3 | 8 | 6 |
|
||||
|
||||
</Route>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue