feat: home growth auto(7→1) and hourly recent-video snapshot
- Add analytics.home_growth_days (auto|1|7); API growth_days=auto tries 7 then 1 - Homepage shows active window and growth-board link; clearer empty reason - New snapshot_recent scheduler task (schedule.recent_snapshot_minutes/days) - run_recent_videos refreshes new aids only; never touches completed/backup - Full 00:01 job keeps ok=1 skip (covers hourly refresh within 1h); mutex with recent
This commit is contained in:
1 parent
04716aec1b
commit
9163f47b76
15 files changed
+496
-22
No files matched your search
@@ -373,7 +373,7 @@ border-color:#3a2c22;color:#f3e9dc}button{background:#e9b97c;color:#2a1a10}}
|
||||
sort=_param(query, "sort", "heat"),
|
||||
within_days=_optional_int(query, "within_days"),
|
||||
year=_year_param(query),
|
||||
growth_days=_int_param(query, "growth_days", 7, 1, 365),
|
||||
growth_days=_growth_days_param(query),
|
||||
folder_id=_optional_int(query, "folder"),
|
||||
q=_optional_str(query, "q"),
|
||||
page=_int_param(query, "page", 1, 1, 1_000_000),
|
||||
@@ -422,7 +422,7 @@ border-color:#3a2c22;color:#f3e9dc}button{background:#e9b97c;color:#2a1a10}}
|
||||
sort=_param(query, "sort", "heat"),
|
||||
within_days=_optional_int(query, "within_days"),
|
||||
year=_year_param(query),
|
||||
growth_days=_int_param(query, "growth_days", 7, 1, 365),
|
||||
growth_days=_growth_days_param(query),
|
||||
folder_id=_optional_int(query, "folder"),
|
||||
q=_optional_str(query, "q"),
|
||||
page=_int_param(query, "page", 1, 1, 1_000_000),
|
||||
@@ -649,6 +649,28 @@ def _year_param(query: Mapping[str, list[str]]) -> int | None:
|
||||
return value
|
||||
|
||||
|
||||
def _growth_days_param(query: Mapping[str, list[str]]) -> int | str:
|
||||
"""榜单传 1~365;首页可传 auto(由查询层按 home_growth_days 解析)。"""
|
||||
raw = _optional_str(query, "growth_days")
|
||||
if raw is None:
|
||||
return 7
|
||||
if raw == "auto":
|
||||
return "auto"
|
||||
try:
|
||||
value = int(raw)
|
||||
except ValueError as exc:
|
||||
raise ApiError(
|
||||
HTTPStatus.BAD_REQUEST, "bad_request",
|
||||
"growth_days 必须是整数或 auto",
|
||||
) from exc
|
||||
if value < 1 or value > 365:
|
||||
raise ApiError(
|
||||
HTTPStatus.BAD_REQUEST, "bad_request",
|
||||
"growth_days 必须在 1~365 之间",
|
||||
)
|
||||
return value
|
||||
|
||||
|
||||
def _int_param(
|
||||
query: Mapping[str, list[str]],
|
||||
name: str,
|
||||
|
||||
Reference in new issue
Block a user