fix(home): server-owned growth window; expose days
Home omits growth_days; backend auto (or home_growth_days 1/7) picks the window. Response includes days alongside growth_days. Growth榜 link uses the returned days. Non-growth sorts treat omitted/auto as 7.
This commit is contained in:
1 parent
9163f47b76
commit
297d9279d8
5 files changed
+52
-28
No files matched your search
@@ -47,8 +47,8 @@ export async function renderHome(root) {
|
||||
api("/api/overview"),
|
||||
api("/api/videos", { sort: "published", within_days: 14, limit: 6 }),
|
||||
api("/api/videos", { sort: "heat", limit: 6 }),
|
||||
// auto:服务端按 analytics.home_growth_days 解析;默认先试 7 天再降到 1 天
|
||||
api("/api/videos", { sort: "growth", growth_days: "auto", limit: 6 }),
|
||||
// 不带天数:后端按 home_growth_days(默认 auto:有 7 日则 7,否则 1)决定,响应带 days
|
||||
api("/api/videos", { sort: "growth", limit: 6 }),
|
||||
]);
|
||||
|
||||
const fans = overview.fans;
|
||||
@@ -60,7 +60,8 @@ export async function renderHome(root) {
|
||||
const pending = overview.counts?.candidates_pending || 0;
|
||||
// 候选提示仅对已登录(或未启用鉴权)用户可见,访客不展示运行期信息。
|
||||
const showCandidates = pending > 0 && canAccessProtected();
|
||||
const growthDays = Number(growth.growth_days) || 1;
|
||||
// 以后端返回的 days(与 growth_days 同步)为准,避免前端再探查
|
||||
const growthDays = Number(growth.days ?? growth.growth_days) || 1;
|
||||
const growthLabel = `近 ${growthDays} 日`;
|
||||
const growthEmptyTitle = growth.reason
|
||||
|| `近 ${growthDays} 日增长暂不可用`;
|
||||
|
||||
Reference in new issue
Block a user