style: auto format
This commit is contained in:
parent
1dd268c1b1
commit
6083aa9a9a
|
|
@ -707,7 +707,7 @@ Example:`https://www.iyingdi.com/tz/people/55547` ,id 是 `55547`
|
|||
|
||||
<Route author="shinanory" example="/mihoyo/sr" path="/mihoyo/sr/:location?/:category?" :paramsDesc="['区域,可选 `zh-cn`(国服,简中)或 `zh-tw`(国际服,繁中)','分类,见下表,默认为最新']">
|
||||
|
||||
| 最新 | 新闻 | 公告 | 活动 |
|
||||
| 最新 | 新闻 | 公告 | 活动 |
|
||||
| -------- | ---- | ------ | -------- |
|
||||
| news-all | news | notice | activity |
|
||||
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ module.exports = {
|
|||
title: '崩坏:星穹铁道 - 新闻',
|
||||
docs: 'https://docs.rsshub.app/game.html##mi-ha-you',
|
||||
source: '/:location/news',
|
||||
target: '/mihoyo/sr/:location'
|
||||
target: '/mihoyo/sr/:location',
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
'mihoyo.com': {
|
||||
_name: '米哈游',
|
||||
|
|
@ -51,7 +51,7 @@ module.exports = {
|
|||
title: '崩坏:星穹铁道 - 新闻',
|
||||
docs: 'https://docs.rsshub.app/game.html##mi-ha-you',
|
||||
source: '/news',
|
||||
target: '/mihoyo/sr'
|
||||
target: '/mihoyo/sr',
|
||||
},
|
||||
],
|
||||
ys: [
|
||||
|
|
|
|||
|
|
@ -2,39 +2,39 @@ const got = require('@/utils/got');
|
|||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
const categories = {
|
||||
'zh-cn':{
|
||||
'news-all':{
|
||||
'zh-cn': {
|
||||
'news-all': {
|
||||
id: '255',
|
||||
title: '最新',
|
||||
},
|
||||
news:{
|
||||
news: {
|
||||
id: '256',
|
||||
title: '新闻'
|
||||
title: '新闻',
|
||||
},
|
||||
notice:{
|
||||
notice: {
|
||||
id: '257',
|
||||
title: '公告',
|
||||
},
|
||||
activity:{
|
||||
activity: {
|
||||
id: '258',
|
||||
title: '活动',
|
||||
},
|
||||
link: 'https://sr.mihoyo.com/news',
|
||||
},
|
||||
'zh-tw':{
|
||||
'news-all':{
|
||||
'zh-tw': {
|
||||
'news-all': {
|
||||
id: '248',
|
||||
title: '最新',
|
||||
},
|
||||
news:{
|
||||
news: {
|
||||
id: '249',
|
||||
title: '資訊'
|
||||
title: '資訊',
|
||||
},
|
||||
notice:{
|
||||
notice: {
|
||||
id: '250',
|
||||
title: '公告',
|
||||
},
|
||||
activity:{
|
||||
activity: {
|
||||
id: '251',
|
||||
title: '活動',
|
||||
},
|
||||
|
|
@ -47,28 +47,25 @@ module.exports = async (ctx) => {
|
|||
const { location = 'zh-cn', category = 'news-all' } = ctx.params;
|
||||
const limit = ctx.query.limit ? parseInt(ctx.query.limit) : 50;
|
||||
let url = '';
|
||||
if (location === 'zh-cn')
|
||||
{
|
||||
if (location === 'zh-cn') {
|
||||
url = `https://api-takumi-static.mihoyo.com/content_v2_user/app/1963de8dc19e461c/getContentList?iPage=1&iPageSize=${limit}&sLangKey=zh-cn&isPreview=0&iChanId=${categories[location][category].id}`;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
url = `https://api-os-takumi-static.hoyoverse.com/content_v2_user/app/113fe6d3b4514cdd/getContentList?iPage=1&iPageSize=${limit}&sLangKey=${location}&isPreview=0&iChanId=${categories[location][category].id}`;
|
||||
};
|
||||
}
|
||||
|
||||
const response = await got(url);
|
||||
const list = response.data.data.list;
|
||||
const items = list.map((item) => ({
|
||||
title: item.sTitle,
|
||||
description: item.sContent,
|
||||
link: `${categories[location].link}/${item.iInfoId}`,
|
||||
pubDate: parseDate(item.dtStartTime),
|
||||
category: item.sCategoryName
|
||||
}));
|
||||
title: item.sTitle,
|
||||
description: item.sContent,
|
||||
link: `${categories[location].link}/${item.iInfoId}`,
|
||||
pubDate: parseDate(item.dtStartTime),
|
||||
category: item.sCategoryName,
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${categories[location][category].title}-崩坏:星穹铁道`,
|
||||
link: url,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue