From 7ba88601717c5e4e7cb64fdd353663594ba3af45 Mon Sep 17 00:00:00 2001 From: QiuSW <105186638@qq.com> Date: Mon, 14 Sep 2026 10:58:55 +0800 Subject: [PATCH] fix: poll shopee sync with task id --- app/admin/apis/shopee_product.go | 5 +++-- tickets/LOCAL-011-shopee-sync-wait-api.md | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/admin/apis/shopee_product.go b/app/admin/apis/shopee_product.go index 6af7e7e..d9f4f3e 100644 --- a/app/admin/apis/shopee_product.go +++ b/app/admin/apis/shopee_product.go @@ -230,11 +230,12 @@ func (e ShopeeProduct) getByShopeeID(c *gin.Context, requireAPIKey bool, syncSho return } if syncShopee { - if _, err := client.SyncShopProduct(ctx, *record); err != nil { + task, err := client.SyncShopProduct(ctx, *record) + if err != nil { e.Error(502, err, "Shopee 商品同步失败:"+err.Error()) return } - if _, err := client.WaitForProductSync(ctx, record.ID, time.Second); err != nil { + if _, err := client.WaitForProductSync(ctx, task.TaskID, time.Second); err != nil { e.Error(502, err, "Shopee 商品同步失败:"+err.Error()) return } diff --git a/tickets/LOCAL-011-shopee-sync-wait-api.md b/tickets/LOCAL-011-shopee-sync-wait-api.md index caea871..d2a4e31 100644 --- a/tickets/LOCAL-011-shopee-sync-wait-api.md +++ b/tickets/LOCAL-011-shopee-sync-wait-api.md @@ -38,3 +38,8 @@ POST /api/v1/shopee/products/{shopeeId}/sync-wait - 保留原有异步 `/sync` 与 `/sync-status` 接口。 - 验证:`go test ./app/admin/apis ./app/admin/router ./internal/huohanhan` 通过,`git diff --check` 通过。 - 当前状态:待验收 + +## 问题修复 +- 修复同步等待时错误使用商品内部 ID 轮询状态的问题。 +- 现在使用 `SyncShopProduct` 返回的真实 `task.TaskID` 查询同步状态,完成后再使用商品内部 ID 获取 detail。 +- 验证:`go test ./app/admin/apis ./internal/huohanhan` 通过。