diff --git a/pipeline_llm/accounting.py b/pipeline_llm/accounting.py index 5ba1b86..3eac9e0 100644 --- a/pipeline_llm/accounting.py +++ b/pipeline_llm/accounting.py @@ -193,9 +193,13 @@ async def _settle_one(sor, row): supplier_cost = float((result or {}).get('supplier_cost', 0) or 0) await _deduct_wallet(sor, row, supplier_cost) # 回填客户应付 + 成本侧金额 + 置已出账 + # ⚠ note=varchar(200):CONCAT 前必须限长——失败重试轮曾把 note 写到 ~185 字符 + # (出账异常长文案),出账成功再 CONCAT '|accounted:'+orderid 直接 1406 溢出 → + # 异常回写 failed → 「修好定价也永远出不了账」死循环(2026-09-16 qwen-image-3.0-pro + # 39 笔实测)。LEFT(...,200) 保底:宁可截尾巴也不让成功账落不下。 await sor.sqlExe( "UPDATE llm_usage SET charge=${c}$, cost=${k}$, accounting_status='accounted', " - "note=CONCAT(COALESCE(note,''),'|accounted:',${o}$) WHERE id=${i}$", + "note=LEFT(CONCAT(COALESCE(note,''),'|accounted:',${o}$),200) WHERE id=${i}$", {"c": float((result or {}).get('customer_amount', 0) or 0), "k": round(supplier_cost, 6), "o": str((result or {}).get('orderid', ''))[:40],