fix(cash): vouchers-json batch改为纯内容指纹(不含时间戳) — 快照每10分钟重推必须幂等命中

- batch=zxt-{sha1前10},同内容任意时刻重推 → 同一batch → already_imported跳过
- 原带秒级时间戳导致指纹去重失效(靠行级防重兜底,但会产生噪音import_logs)
- 验收脚本补用例4b(三次重发batch不变+already_imported), 13/13 PASS
This commit is contained in:
Hermes CI Fix
2026-09-06 16:47:25 +08:00
parent 3db805db4e
commit 594bb00a38
2 changed files with 9 additions and 2 deletions
+2 -2
View File
@@ -313,9 +313,9 @@ def api_import_vouchers_json(
success = len(valid_rows)
failed = len(errors)
# ── 幂等:batch 指纹去重 ──
# ── 幂等:batch 内容指纹去重(batch 不含时间戳——同内容快照每10分钟重推必须命中同一 batch)──
fingerprint = _content_fingerprint(rows_raw)
batch = f"zxt-{datetime.now().strftime('%Y%m%d%H%M%S')}-{fingerprint}"
batch = f"zxt-{fingerprint}"
existing_batch = db.query(ImportLog).filter(
ImportLog.batch == batch,
ImportLog.import_type == "vouchers-json",