feat(#48): add SYB sync orchestration, import endpoint and page entry
Stage 2. Completes the path from the SYB API to the archive. sybimport.Sync pages a date range day by day and folds each detail line through the existing idempotent ApplyDetail. The paging loop is driven by listTotal, never by the list response's own total, which live data confirmed is the page's row count rather than the filtered total. A day whose completeness cannot be proven — a short page, a total that drifted while paging, a detail response missing an order — stops the run instead of reporting a partial import as a whole one. Rows already written stay: they are idempotent on (order_code, detail_id), so a re-run overwrites. sybimport.Connect reuses the cached session and only discards it when SYB explicitly says it is invalid. Caching the numeric user id alongside the cookies is required, not incidental: session validation calls /am/user/get?id=, and a wrong id comes back as a business error rather than a logout, so cookies alone can never be revalidated. The import endpoint is single-flight and detached from the request context, so closing the tab cannot abandon a half-finished range. It reads only; no SYB write endpoint is reachable from GoAuto. The page swaps its "no import entry" warning for a date-range dialog that warns when the span is wide — a single week held over 7000 orders — and reports partial progress when a run fails midway. Verified: go build, go vet, go test ./... all pass. The drift check was mutation-tested. Not verified: the MySQL migration for syb_session, and any browser walkthrough. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
generated: true (请先修改 Gitea Wiki,禁止直接编辑本文件)
|
||||
wiki_page: Architecture-and-Code-Map
|
||||
wiki_url: https://git.ilapage.cn/OPC/goauto/wiki/Architecture-and-Code-Map.-
|
||||
wiki_revision: 945d51155a72ea5b41f600262590cf928de3f5ab
|
||||
synchronized_at: 2026-08-19T08:15:27Z
|
||||
wiki_revision: a94218dc2c7cbf1c5d56af808a02bf65aaa19964
|
||||
synchronized_at: 2026-08-19T08:53:52Z
|
||||
<!-- gitea-wiki-mirror:end -->
|
||||
|
||||
# 架构与代码地图
|
||||
@@ -81,7 +81,8 @@ Android Portal/Agent
|
||||
| PDD 商品档案增量迁移 | `server/cmd/migrate/migration/version-local/1786700500000_pdd_product_archive.go` |
|
||||
| 虾皮商品档案与规格映射 | `server/app/goauto/shopeeproduct/`(服务端 API 已实现;Admin 页面待实现) |
|
||||
| 虾皮商品档案增量迁移 | `server/cmd/migrate/migration/version-local/1786700600000_shopee_product_archive.go` |
|
||||
| SYB 商品明细导入、解析与虾皮档案合并 | `server/app/goauto/sybimport/`(解析、幂等落库、管理端 API 已实现;SYB 接口拉取客户端未实现,无凭据;Admin 页面已实现) |
|
||||
| SYB 商品明细导入、解析与虾皮档案合并 | `server/app/goauto/sybimport/`(解析、幂等落库、同步编排、导入端点、管理端 API 和 Admin 页面均已实现) |
|
||||
| 顺云宝(SYB)ERP HTTP 客户端与登录会话 | `server/app/goauto/sybclient/`(登录、OCR 验证码、会话缓存、列表与明细读取;见 [SYB-ERP-Interface-Contract](SYB-ERP-Interface-Contract)) |
|
||||
| SYB 商品明细增量迁移 | `server/cmd/migrate/migration/version-local/1786700700000_syb_product_import.go` |
|
||||
| 任务领取、结果、重置与删除 | `server/app/goauto/task/` |
|
||||
| 管理端基线 | `web/`(go-admin-ui v3.0.0) |
|
||||
|
||||
Reference in New Issue
Block a user