From a0bd798d8aeacd0ad08a4c3d3456698dade705f0 Mon Sep 17 00:00:00 2001 From: huanghaosheng <386998068@qq.com> Date: Sun, 1 Nov 2026 15:40:00 +0800 Subject: [PATCH] =?UTF-8?q?refactor(feed):=20=E5=88=A0=E9=99=A4=E7=83=AD?= =?UTF-8?q?=E6=A6=9C=E5=93=8D=E5=BA=94=E9=87=8C=E4=BB=8E=E6=9C=AA=E8=B5=8B?= =?UTF-8?q?=E5=80=BC=E7=9A=84=E6=B8=B8=E6=A0=87=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `ListByPopularityResponse` 里的 `next_latest_*` 三个字段全仓从未被赋值。 它们只在结构体上声明,`omitempty` 下 JSON 里根本不会出现。 删掉后响应只剩 `as_of` / `next_offset` / `ranking_source` / `snapshot_rebuilt` 四个快照字段。 `frontend/src/api/types.ts` 保留废弃声明,因此非浏览器客户端仍可解码。 验证:go build ./... 与 go vet ./... 通过。go test -count=1 ./internal/feed/ ./internal/http/ 全绿。 --- backend/internal/feed/entity.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/backend/internal/feed/entity.go b/backend/internal/feed/entity.go index ad3210f..f24e721 100644 --- a/backend/internal/feed/entity.go +++ b/backend/internal/feed/entity.go @@ -1,7 +1,5 @@ package feed -import "time" - type FeedAuthor struct { ID uint `json:"id"` Username string `json:"username"` @@ -79,10 +77,4 @@ type ListByPopularityResponse struct { // SnapshotRebuilt 为 true 表示服务端刚重建过快照(原来的过期或被驱逐), // 这一页可能与上一页重叠:客户端应当从 offset 0 重来。 SnapshotRebuilt bool `json:"snapshot_rebuilt"` - - // Deprecated: 旧版用 DB 的 (popularity, create_time, id) 游标继续翻页。 - // 那套游标与 ZSET 的排名无关(N7),服务端已不再读取,字段仅为兼容保留。 - NextLatestPopularity *int64 `json:"next_latest_popularity,omitempty"` - NextLatestBefore *time.Time `json:"next_latest_before,omitempty"` - NextLatestIDBefore *uint `json:"next_latest_id_before,omitempty"` }