feat(web): default video sort to published and UP sort to avg_views

This commit is contained in:
kairee committed 2026-11-03 03:09:53 +08:00
1 parent 764bde65d9
commit 11930db2bf
8 files changed
+31 -20

No files matched your search

+4 -4
View File
@@ -370,7 +370,7 @@ border-color:#3a2c22;color:#f3e9dc}button{background:#e9b97c;color:#2a1a10}}
return
if path == "/api/videos":
self._send_json(HTTPStatus.OK, queries.list_videos(
sort=_param(query, "sort", "heat"),
sort=_param(query, "sort", "published"),
within_days=_optional_int(query, "within_days"),
year=_year_param(query),
growth_days=_growth_days_param(query),
@@ -403,7 +403,7 @@ border-color:#3a2c22;color:#f3e9dc}button{background:#e9b97c;color:#2a1a10}}
scope = _param(query, "scope", "video")
if scope == "up":
self._send_json(HTTPStatus.OK, queries.list_ups(
sort=_param(query, "sort", "efficiency"),
sort=_param(query, "sort", "avg_views"),
within_days=_optional_int(query, "within_days"),
year=_year_param(query),
q=_optional_str(query, "q"),
@@ -419,7 +419,7 @@ border-color:#3a2c22;color:#f3e9dc}button{background:#e9b97c;color:#2a1a10}}
if scope != "video":
raise ApiError(HTTPStatus.BAD_REQUEST, "bad_request", "scope 必须是 video 或 up")
self._send_json(HTTPStatus.OK, queries.list_videos(
sort=_param(query, "sort", "heat"),
sort=_param(query, "sort", "published"),
within_days=_optional_int(query, "within_days"),
year=_year_param(query),
growth_days=_growth_days_param(query),
@@ -435,7 +435,7 @@ border-color:#3a2c22;color:#f3e9dc}button{background:#e9b97c;color:#2a1a10}}
return
if path == "/api/ups":
self._send_json(HTTPStatus.OK, queries.list_ups(
sort=_param(query, "sort", "efficiency"),
sort=_param(query, "sort", "avg_views"),
within_days=_optional_int(query, "within_days"),
year=_year_param(query),
q=_optional_str(query, "q"),