fix(wallstreetcn): crash when article delete (#17734)
* fix(wallstreetcn): crash when article delete TypeError: Cannot read properties of undefined (reading 'display_name') * fix(style): camelCase
This commit is contained in:
@@ -74,7 +74,14 @@ async function handler(ctx) {
|
||||
url: `${apiRootUrl}/apiv1/content/${item.type === 'live' ? `lives/${item.guid}` : `articles/${item.guid}?extract=0`}`,
|
||||
});
|
||||
|
||||
const data = detailResponse.data.data;
|
||||
const responseData = detailResponse.data;
|
||||
|
||||
// 处理 { code: 60301, message: '内容不存在或已被删除', data: {} }
|
||||
if (responseData.code !== 20000) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const data = responseData.data;
|
||||
|
||||
item.title = data.title || data.content_text;
|
||||
item.author = data.source_name ?? data.author.display_name;
|
||||
@@ -95,6 +102,8 @@ async function handler(ctx) {
|
||||
)
|
||||
);
|
||||
|
||||
items = items.filter((item) => item !== null);
|
||||
|
||||
return {
|
||||
title: `华尔街见闻 - 资讯 - ${titles[category]}`,
|
||||
link: currentUrl,
|
||||
|
||||
Reference in New Issue
Block a user