From 5faf870d0f6ee42eb0c4176588c0ffcdb9739f99 Mon Sep 17 00:00:00 2001 From: QiuSW <105186638@qq.com> Date: Thu, 24 Sep 2026 08:52:47 +0800 Subject: [PATCH] refactor(web): rename returns list columns, add resync-updates-times test (#337) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 商品标题/规格 -> 商品标题 (drop the spec subtitle, already shown in the 独立 规格数据 column). 认领时间 -> 上架时间 in the list. The detail drawer still says 认领时间, unchanged per the request scope. Also locks in existing sync behavior with a regression test: a resync of the same package must overwrite claim_time and destroy_dead_line, not just last_synced_at (server/.../sync.go already did this; the test only adds coverage). Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01NTDbDcwbDw1TSAcE6wfh2F --- server/app/goauto/yeeke/sync_paging_test.go | 49 ++++++++++++++++++++ web/src/views/goauto/yeeke-returns/index.vue | 9 ++-- 2 files changed, 52 insertions(+), 6 deletions(-) diff --git a/server/app/goauto/yeeke/sync_paging_test.go b/server/app/goauto/yeeke/sync_paging_test.go index 8b6bac1..a9a502d 100644 --- a/server/app/goauto/yeeke/sync_paging_test.go +++ b/server/app/goauto/yeeke/sync_paging_test.go @@ -728,3 +728,52 @@ func TestItemKeyDistinctVariationsOfSameItemID(t *testing.T) { t.Fatalf("items=%d, want 2 (same itemID with different variationID must stay distinct)", n) } } + +// TestResyncUpdatesClaimTimeAndDestroyDeadLine: yeeke may correct a package's +// claim time or destroy deadline between two syncs of the same package. The +// second sync must overwrite the stored values, not just refresh +// last_synced_at. +func TestResyncUpdatesClaimTimeAndDestroyDeadLine(t *testing.T) { + db := testDB(t) + recordWithTimes := func(claimTime, destroyDeadLine string) string { + b, _ := json.Marshal(map[string]any{ + "id": "p1", "ordersn": "o-p1", "trackingNo": "t-p1", "status": "1", + "claimTime": claimTime, "destroyDeadLine": destroyDeadLine, + "items": []map[string]any{{ + "id": "p1-i1", "itemId": "i", "variationId": "v1", + "itemName": "n", "variationName": "v", "variationQuantityPurchased": "1", + }}, + }) + return string(b) + } + var body string + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + fmt.Fprint(w, body) + })) + defer srv.Close() + c, _ := yeekeclient.New(srv.URL) + s := NewService(db, c, Config{PageSize: 20}) + + body = page([]string{recordWithTimes("2026-09-01 10:00:00", "2026-10-01 10:00:00")}, 1, 1) + if _, err := s.Sync(context.Background(), "manual"); err != nil { + t.Fatalf("first sync: %v", err) + } + var row models.YeekeReturnPackage + db.Where("external_id = ?", "p1").First(&row) + if got := row.ClaimTime.Format("2006-01-02"); got != "2026-09-01" { + t.Fatalf("claim_time after first sync = %s", got) + } + + body = page([]string{recordWithTimes("2026-09-15 08:00:00", "2026-10-15 08:00:00")}, 1, 1) + if _, err := s.Sync(context.Background(), "manual"); err != nil { + t.Fatalf("second sync: %v", err) + } + db.Where("external_id = ?", "p1").First(&row) + if got := row.ClaimTime.Format("2006-01-02"); got != "2026-09-15" { + t.Fatalf("claim_time after resync = %s, want updated value", got) + } + if got := row.DestroyDeadLine.Format("2006-01-02"); got != "2026-10-15" { + t.Fatalf("destroy_dead_line after resync = %s, want updated value", got) + } +} diff --git a/web/src/views/goauto/yeeke-returns/index.vue b/web/src/views/goauto/yeeke-returns/index.vue index 108e8f7..fa25f66 100644 --- a/web/src/views/goauto/yeeke-returns/index.vue +++ b/web/src/views/goauto/yeeke-returns/index.vue @@ -35,12 +35,9 @@ — - + @@ -64,7 +61,7 @@ {{ claimStatusMeta(row.claimStatus).label }} - +