feat(shipping): 实现订单批处理聊天聚合展示与优化后端逻辑

This commit is contained in:
hugo committed 2026-08-13 17:40:43 +08:00
1 parent 11cef575b4
commit 523b791c92
38 files changed
+2868 -414

No files matched your search

@@ -346,6 +346,25 @@ def append_shipping_audit_event(
resolved_reason_code = str(reason_code)[:128] if reason_code else None
resolved_sensitivity = str(sensitivity_level)[:16] if sensitivity_level else None
# #region debug-point A/B/C/D:submission-audit-flush
try:
import os
import urllib.request
debug_env = Path(__file__).resolve().parents[5] / '.dbg' / 'order-submission-deadlock.env'
debug_values = {
line.split('=', 1)[0]: line.split('=', 1)[1].strip()
for line in debug_env.read_text(encoding='utf-8').splitlines()
if '=' in line
}
urllib.request.urlopen(urllib.request.Request(
debug_values.get('DEBUG_SERVER_URL', 'http://127.0.0.1:7777/event'),
data=json.dumps({'sessionId': debug_values.get('DEBUG_SESSION_ID', 'order-submission-deadlock'), 'runId': 'pre-fix', 'hypothesisId': 'A/B/C/D', 'location': 'audit_service.py:349', 'msg': '[DEBUG] audit flush lock state', 'data': {'pid': os.getpid(), 'aggregate_type': str(aggregate_type)[:64], 'aggregate_id': str(aggregate_id)[:128], 'event_type': str(event_type)[:64], 'in_transaction': db.session.in_transaction()}}).encode(),
headers={'Content-Type': 'application/json'},
), timeout=1).read()
except Exception:
pass
# #endregion
# [STEP 2] flush 同事务先前事件,保证哈希链前驱可查。
db.session.flush()
previous_event_hash = resolve_previous_event_hash(