feat: 详情页相关推荐左右箭头翻页(复用首页PaginatedRow) + /api/related 候选12→36/返回10→30 (fixed134)
Docker Build & Test / build (push) Canceled after 0s
Docker Build & Test / test (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/amd64) (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/arm/v7) (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/arm64) (push) Canceled after 0s
Build & Push Docker image / merge-images (push) Canceled after 0s
Release / release (push) Canceled after 0s
Release / docker (push) Canceled after 0s

This commit is contained in:
jinghui committed 2026-11-16 23:04:37 +08:00
1 parent 3b9f3bbf5d
commit 58fb815c17
6 files changed
+26 -10

No files matched your search

+4 -3
View File
@@ -157,9 +157,10 @@ export async function GET(request: Request) {
});
if (pool.length === 0) return respond([]);
// 3) 按来源强度排序,取前 12 补全元数据(主演/导演/地区/语言 只在详情里有)
// 3) 按来源强度排序,取前 36 补全元数据(主演/导演/地区/语言 只在详情里有);
// 多补候选是为了前端相关推荐能翻页(每页 10 条,最多 3 页,与首页港剧行一致)
pool.sort((a, b) => b.dir * 2 + b.act - (a.dir * 2 + a.act));
const top = pool.slice(0, 12);
const top = pool.slice(0, 36);
const siteMap = new Map<string, ApiSite>(
sites.map((s) => [s.key, s] as [string, ApiSite])
);
@@ -256,7 +257,7 @@ export async function GET(request: Request) {
}
items.sort((a, b) => b.score - a.score);
const finalItems = items.slice(0, 10);
const finalItems = items.slice(0, 30);
if (cache.size > 100) cache.clear();
cache.set(cacheKey, { ts: Date.now(), items: finalItems });
+5 -2
View File
@@ -3,6 +3,8 @@
import Link from 'next/link';
import { useEffect, useState } from 'react';
import PaginatedRow from '@/components/PaginatedRow';
interface DoubanComment {
id: string;
user: string;
@@ -265,7 +267,8 @@ export default function VideoMetaExtra({
</div>
)}
{related.length > 0 && (
<div className='grid grid-cols-5 gap-3'>
/* 与首页「最新港剧」同款 PaginatedRow 翻页:左右箭头 hover 显示,每页 10 条 */
<PaginatedRow itemsPerPage={10}>
{related.map((r: any) => (
<a
key={`${r.source}-${r.id}`}
@@ -297,7 +300,7 @@ export default function VideoMetaExtra({
)}
</a>
))}
</div>
</PaginatedRow>
)}
</div>
)}