mirror of
https://github.com/MoonTechLab/LunaTV.git
synced 2026-05-22 14:37:30 +08:00
fix: filter 0 episode movie
This commit is contained in:
@@ -58,6 +58,9 @@ async function searchWithCache(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
if (apiSite.key === 'xiaomaomi') {
|
||||||
|
console.log(data);
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
!data ||
|
!data ||
|
||||||
!data.list ||
|
!data.list ||
|
||||||
@@ -69,7 +72,7 @@ async function searchWithCache(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 处理结果数据
|
// 处理结果数据
|
||||||
const results = data.list.map((item: ApiSearchItem) => {
|
const allResults = data.list.map((item: ApiSearchItem) => {
|
||||||
let episodes: string[] = [];
|
let episodes: string[] = [];
|
||||||
let titles: string[] = [];
|
let titles: string[] = [];
|
||||||
|
|
||||||
@@ -117,6 +120,9 @@ async function searchWithCache(
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 过滤掉集数为 0 的结果
|
||||||
|
const results = allResults.filter((result: SearchResult) => result.episodes.length > 0);
|
||||||
|
|
||||||
const pageCount = page === 1 ? data.pagecount || 1 : undefined;
|
const pageCount = page === 1 ? data.pagecount || 1 : undefined;
|
||||||
// 写入缓存(成功)
|
// 写入缓存(成功)
|
||||||
setCachedSearchPage(apiSite.key, query, page, 'ok', results, pageCount);
|
setCachedSearchPage(apiSite.key, query, page, 'ok', results, pageCount);
|
||||||
|
|||||||
Reference in New Issue
Block a user