Files
admin9webs f5720ad613 店小秘多平台铺货配方:7 平台建品脚本 + 静默拦截诊断法 + 项目状态
- TikTok/Shopee/速卖通/Walmart 各 46-47 条已在待发布
- Ozon 47 条已建、改价 40/47
- SHEIN 配方跑通第一条;Temu 差「预览图」一步
- 核心产出:MYJ.message.error 钩子诊断法(解开了三个平台的保存静默拦截)
- 含下一轮提示词 NEXT-ROUND-PROMPT.md
2026-09-20 17:29:38 +08:00

35 lines
1.7 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
"""EAN-13 生成本地复算(湖北易千亿彩 · 69803093 段)
结构: 8位前缀 69803093 + 4位产品码 + 1位校验
校验: 前12位左起权重 1,3,1,3... ; check=(10-sum%10)%10"""
def ean13_check(d12: str) -> int:
total = sum(int(d) * (1 if i % 2 == 0 else 3) for i, d in enumerate(d12))
return (10 - total % 10) % 10
def make(pc: int) -> str:
d12 = "69803093" + f"{pc:04d}"
return d12 + str(ean13_check(d12))
if __name__ == "__main__":
# 1) 复算文档里的例子,验证算法
print("=== 算法自检 ===")
for pc, expect in ((2900, "6980309329009"), (3400, "6980309334003"), (9999, "6980309399996")):
got = make(pc)
print(f" pc {pc:>4} → {got} {'✅' if got == expect else '❌ 期望 ' + expect}")
doc_wrong = make(1000)
print(f" pc 1000 → {doc_wrong} (文档写 6980309310004,实为 {doc_wrong} ← 文档该例有误)")
print(f" pc 0000 → {make(0)}")
print()
# 2) 为 Walmart 分配 47 个(pc 3400..3446)
START, N = 3400, 47
codes = [make(START + i) for i in range(N)]
assert len(set(codes)) == N, "批内重复"
for c in codes:
assert ean13_check(c[:12]) == int(c[12]), f"校验位错 {c}"
print(f"=== 分配 pc {START}~{START+N-1} 共 {N} 个(校验位全部复核通过)===")
for i, c in enumerate(codes):
print(f" {START+i:>4} {c}")
open("/home/admin9webs/walmart建品/ean_69803093_%d-%d.txt" % (START, START + N - 1), "w").write("\n".join(codes) + "\n")
print(f"\n已落盘: ean_69803093_{START}-{START+N-1}.txt")
print(f"下一号应为 pc {START+N} → {make(START+N)};剩余 {9999-(START+N)+1} 个")