From c2ebf5758e1fe282cbdbc10ce09be24c4c9ba41c Mon Sep 17 00:00:00 2001 From: shinya Date: Mon, 14 Jul 2025 20:53:40 +0800 Subject: [PATCH] fix: add await --- src/app/api/detail/route.ts | 2 +- src/app/api/douban/route.ts | 4 ++-- src/app/api/search/one/route.ts | 4 ++-- src/app/api/search/resources/route.ts | 4 ++-- src/app/api/search/route.ts | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app/api/detail/route.ts b/src/app/api/detail/route.ts index def1fc3..29b7883 100644 --- a/src/app/api/detail/route.ts +++ b/src/app/api/detail/route.ts @@ -27,7 +27,7 @@ export async function GET(request: Request) { } const result = await getDetailFromApi(apiSite, id); - const cacheTime = getCacheTime(); + const cacheTime = await getCacheTime(); return NextResponse.json(result, { headers: { diff --git a/src/app/api/douban/route.ts b/src/app/api/douban/route.ts index 289e961..ead1c55 100644 --- a/src/app/api/douban/route.ts +++ b/src/app/api/douban/route.ts @@ -108,7 +108,7 @@ export async function GET(request: Request) { list: list, }; - const cacheTime = getCacheTime(); + const cacheTime = await getCacheTime(); return NextResponse.json(response, { headers: { 'Cache-Control': `public, max-age=${cacheTime}`, @@ -180,7 +180,7 @@ function handleTop250(pageStart: number) { list: movies, }; - const cacheTime = getCacheTime(); + const cacheTime = await getCacheTime(); return NextResponse.json(apiResponse, { headers: { 'Cache-Control': `public, max-age=${cacheTime}`, diff --git a/src/app/api/search/one/route.ts b/src/app/api/search/one/route.ts index 58d8b36..95e88a0 100644 --- a/src/app/api/search/one/route.ts +++ b/src/app/api/search/one/route.ts @@ -12,7 +12,7 @@ export async function GET(request: Request) { const resourceId = searchParams.get('resourceId'); if (!query || !resourceId) { - const cacheTime = getCacheTime(); + const cacheTime = await getCacheTime(); return NextResponse.json( { result: null, error: '缺少必要参数: q 或 resourceId' }, { @@ -40,7 +40,7 @@ export async function GET(request: Request) { const results = await searchFromApi(targetSite, query); const result = results.filter((r) => r.title === query); - const cacheTime = getCacheTime(); + const cacheTime = await getCacheTime(); if (result.length === 0) { return NextResponse.json( diff --git a/src/app/api/search/resources/route.ts b/src/app/api/search/resources/route.ts index 15b1bed..59ba776 100644 --- a/src/app/api/search/resources/route.ts +++ b/src/app/api/search/resources/route.ts @@ -7,8 +7,8 @@ export const runtime = 'edge'; // OrionTV 兼容接口 export async function GET() { try { - const apiSites = getAvailableApiSites(); - const cacheTime = getCacheTime(); + const apiSites = await getAvailableApiSites(); + const cacheTime = await getCacheTime(); return NextResponse.json(apiSites, { headers: { diff --git a/src/app/api/search/route.ts b/src/app/api/search/route.ts index 9b5541d..1223604 100644 --- a/src/app/api/search/route.ts +++ b/src/app/api/search/route.ts @@ -27,7 +27,7 @@ export async function GET(request: Request) { try { const results = await Promise.all(searchPromises); const flattenedResults = results.flat(); - const cacheTime = getCacheTime(); + const cacheTime = await getCacheTime(); return NextResponse.json( { results: flattenedResults },