Commit Graph
73 Commits
Author SHA1 Message Date
QiuSW 5feb4e8571 feat(web): enforce server-driven GoAuto menus (#138) 2026-08-28 22:16:51 +08:00
QiuSW 72f54f76ac feat(goauto): add configurable module menus (#137) 2026-08-28 21:21:40 +08:00
QiuSW 679f4691a4 feat(goauto): add stock purchase task type (#135) 2026-08-28 20:53:51 +08:00
QiuSW 0f522d5339 feat(#132): continue purchase after replacement 2026-08-28 18:32:17 +08:00
QiuSW 33d4bb17ad feat(#130): collect replacement products from Agent 2026-08-28 18:20:24 +08:00
QiuSW 92385c4a8d feat(#131): activate product replacements safely 2026-08-28 17:56:17 +08:00
QiuSW 696e0bca52 feat(#129): add PDD product replacement model 2026-08-28 17:33:15 +08:00
QiuSW 5c6655f706 feat(#119 #120 #121): implement SYB inner-code workflow 2026-08-28 10:24:15 +08:00
QiuSW e117fd222d feat(#115): move PDD recognition aliases into rules 2026-08-27 18:19:33 +08:00
QiuSW 3619435a97 refactor(#116): separate read-only aliases from actions 2026-08-27 18:02:32 +08:00
QiuSW bc9c637522 fix(#113): restore hidden PDD spec headings 2026-08-27 17:29:24 +08:00
QiuSW daf7406ec9 fix: expand all whitelisted PDD share links (#109) 2026-08-27 15:32:40 +08:00
QiuSW 20775cc1bf fix: resolve PDD share links on Agent (#108) 2026-08-27 15:04:19 +08:00
QiuSW 28c3cb5138 feat: collect current PDD page from Agent (#101) 2026-08-27 10:53:48 +08:00
QiuSW eec63a0653 feat: sync agent task history (#99) 2026-08-26 16:10:12 +08:00
QiuSW 5f2dd05ebd feat: add safe agent purchase retry (#95) 2026-08-26 14:37:01 +08:00
QiuSW 7b6cc00503 feat(agent): implement #91 controlled recollection 2026-08-26 10:17:45 +08:00
QiuSW b885a4ef66 feat(agent): implement #90 task history 2026-08-26 09:26:38 +08:00
QiuSW ae9a9fef6f fix: add purchaser role permissions (#85) 2026-08-25 14:25:22 +08:00
QiuSW a622d718e0 fix(#84): restore collection selection in locate mode 2026-08-25 11:05:56 +08:00
QiuSW 7b488e2c68 fix(#82): separate PDD linking from mapping 2026-08-25 10:21:10 +08:00
QiuSW 0794dc580b feat(#80): add SYB product process stages 2026-08-25 09:44:02 +08:00
QiuSW af3dd5563b fix(#79): retry transient SYB read failures 2026-08-24 17:31:34 +08:00
QiuSW a2cc9a144f feat(#75): 增加 SYB 每小时自动同步 2026-08-24 16:02:16 +08:00
QiuSW 0fccbc99c1 feat(#74): 优化 SYB 商品筛选和列表布局 2026-08-24 15:10:47 +08:00
QiuSW 634bd46729 fix(#73): speed up SYB purchase preview 2026-08-24 11:48:56 +08:00
QiuSW 166adc6fa8 feat(#70): import cmautobuy product catalog 2026-08-23 23:59:12 +08:00
QiuSW 67d8f32eaf feat(#69): add Shopee PDD specification mapping 2026-08-23 23:23:42 +08:00
QiuSW 9490bddf8f feat(#67): add Shopee order snapshots to purchase tasks 2026-08-22 10:41:05 +08:00
QiuSW 22a024be64 fix(#64): bound purchase spec selection retries 2026-08-22 09:07:13 +08:00
QiuSW ec9f47f2ab fix(#63): keep AI matching out of purchase queries 2026-08-21 18:02:58 +08:00
QiuSW 0e3be46c4c feat(#62): extend AI matching timeout 2026-08-21 17:23:02 +08:00
QiuSW 6181d97f39 feat(#62): add AI specification matching settings 2026-08-21 17:04:49 +08:00
QiuSW aebe80f305 fix(#61): use safe purchase spec entry 2026-08-21 16:08:57 +08:00
QiuSW 01d852011a feat(#58): batch retry failed purchase tasks 2026-08-21 14:20:40 +08:00
QiuSW 7e4f404265 feat(#44): create purchase tasks from SYB products 2026-08-21 10:17:31 +08:00
QiuSW 9ee03ec30f fix(#56): add go-admin success envelope 2026-08-20 23:33:52 +08:00
QiuSW 182ef3940a feat(#55): add purchase admin query APIs 2026-08-20 23:31:23 +08:00
QiuSW b0f33bf679 fix(#54): unify device state across task domains 2026-08-20 22:53:15 +08:00
QiuSW afeb2723ea fix(#53): parameterize purchase rule actions 2026-08-20 17:53:10 +08:00
QiuSW 65ae41fd6f feat(#34): implement purchase task state machine 2026-08-20 17:22:52 +08:00
QiuSW 978f42806a feat(#33): define purchase task data and API contract 2026-08-20 16:49:43 +08:00
QiuSW 903280fada fix(#52): align SYB sync count columns with MySQL 2026-08-20 16:19:54 +08:00
QiuSW 32edb91a31 fix(#52): expose SYB preflight failure stages 2026-08-20 16:09:28 +08:00
QiuSW badb78fa68 feat(#50): run SYB imports asynchronously 2026-08-20 15:24:50 +08:00
QiuSW 6c7a7298e3 feat(#49): complete SYB shop management 2026-08-20 11:54:11 +08:00
QiuSWandClaude Opus 5 1b67495e71 feat(#49): add shop HTTP API, SYB discovery and the import filter
Stage B steps 3 and 4.

The filter runs after loadDailyList has proved the day's snapshot whole,
never before. Filtering first would let drift among other shops' orders
hide a hole in the ones we do want. OrderCount stays the unfiltered total
alongside AcceptedCount and ShopSkipped, so a shop missing from the
allow-list shows up as a number rather than as absent data.

An empty allow-list is a refusal, not "import everything" — the latter
looks exactly like a filter that works. Mutation-tested, along with the
detail-level shop re-check that catches a list and detail response
disagreeing about which shop an order belongs to.

ShopBreakdown counts orders per shop including skipped ones, under the
stored display name rather than SYB's spelling, so one shop cannot appear
under two spellings. #50 renders it.

Discovery lives in sybimport, not sybshop: it needs the SYB client, and
sybimport already depends on sybshop for the filter, so the reverse would
be an import cycle. It reads the list endpoint only and never adds a
shop — widening what gets imported stays an explicit action.

Read and write routes are registered separately. GoAuto inherits
go-admin's per-path permission model, so "配置仅管理员" is expressible but
not enforced in code; the grant is configured in 系统管理.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 11:31:44 +08:00
QiuSWandClaude Opus 5 7bd8166a30 feat(#49): add shop service — CRUD, enable toggle and enabled-name lookup
Stage B step 2 (service layer; HTTP handlers next).

Rename rewrites NormalizedName along with DisplayName. Leaving the key
stale would show the new name while still matching the old one, so the
archive would look correctly configured while importing a different shop.
Mutation-tested: updating only display_name makes the rename test fail.

Duplicates are reported against the name already stored, not the one just
submitted — the two can differ only in case or character width, and
echoing back what was typed reads as the system rejecting a name it does
not have.

Delete is a soft delete carrying the id into DeletedFlag, so the same
name can be added again afterwards while past sync records keep resolving
the old row.

EnabledNames returns an empty map without error. Empty is a legitimate
state that callers must turn into "refuse to sync", never "import
everything".

MarkSeen only updates shops already on the list. A sync must not grow the
allow-list as a side effect; discovery is a separate explicit action.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 11:23:02 +08:00
QiuSWandClaude Opus 5 cda37b4a60 feat(#49): add syb_shop model, migration and name normalization
Stage B step 1. The shop list decides which of a SYB account's shops get
imported.

Matching is by name, so the normalized form is the real key: whitespace
trimmed, full-width ASCII folded, letters lowercased. " ABC店 ", "ABC店"
and "abc店" are one shop. DisplayName is only ever shown to people, and
the unique index sits on the normalized column so a caller that skips
normalization cannot create rows that look identical on screen.

Interior whitespace is deliberately not collapsed: two shops differing
only there are still two shops, and merging them silently would be worse
than the duplicate this prevents.

Soft delete uses the DeletedFlag sentinel rather than a nullable
deleted_at in the unique index, which is silently inert because unique
indexes treat every NULL as distinct. Mutation-tested: dropping the
sentinel from the index makes the recreate-after-delete case fail.

The version-local migration file is included this time — the model alone
would never reach an existing database.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 11:18:32 +08:00
QiuSWandClaude Opus 5 e6f533b71e fix(#48): add the missing version-local migration for syb_session
Adding SYBSession to migrations.Migrate was not enough. Schema reaches an
existing database only through a version-local file; with the previous
version already recorded in sys_migration, Migrate never re-ran and the
table simply never appeared. The unit tests build a fresh database every
time, so they stayed green while the real database was missing a table —
which surfaced as "Error 1146: Table 'goauto.syb_session' doesn't exist"
on the first import attempt.

server/.gitignore was hiding these files. go-admin ignores version-local
because it is where generated local migrations land, but every GoAuto
migration belongs in version control; the existing ones had been forced
in with `git add -f`. Un-ignoring *.go there also recovers four migrations
that were never committed at all — 1786700000000 through 1786700300000,
covering the base schema, device registration, heartbeat and collection
execution. A fresh clone could not have built a working database.

Guard the class of mistake rather than just this instance:

  - migrations.VerifyTables checks every model's table after migrating and
    names what is missing along with the fix.
  - The migrate command runs it, so the failure lands at migrate time
    instead of at the first request that needs the table.
  - initDB no longer discards migrateModel's error. Upstream had
    `_ = migrateModel()` followed by an unconditional "初始化成功", so a
    failed migration reported success and the launcher believed it.

Also records the two-step rule in Common-Changes: a new model needs both
the model registration and a new version file.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 10:10:11 +08:00