协商中再问按后台超时小时顺延并可强制清跟进时刻;工单与账号支持按筛选导出 Excel。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
linmianxun
2026-10-13 12:34:03 +08:00
co-authored by Cursor
parent 97f0219dfd
commit 0b2f0b76c4
36 changed files with 867 additions and 64 deletions
+22 -5
View File
@@ -2775,6 +2775,7 @@ def deal_ack(
work_order_no: str,
next_followup_at: str = "",
lost_reason: str = "",
followup_hours: float | None = None,
) -> str:
"""成交三态回执。后台 deal.recorded_won / lost.ask_reason / negotiating.recorded。"""
no = (work_order_no or "").strip()
@@ -2789,26 +2790,42 @@ def deal_ack(
if reason:
return f"已记录为「未成交」。{lost_reason_ack(reason, work_order_no=no)}"
return _r("lost.ask_reason", "已记录为「未成交」。请补充未成交原因。", ticket_no=no)
when = _followup_month_day(next_followup_at) or "第四个工作日"
from agent.policy.event_exception import format_timeout_hours
# 小时缺省按后台默认 48;0 表示运营关掉再问,话术仍说明已记录协商中
hours_val = 48.0 if followup_hours is None else float(followup_hours)
hours_text = format_timeout_hours(hours_val if hours_val > 0 else 48.0)
when = _followup_when_text(next_followup_at) or f"{hours_text} 个工作小时后"
return _r(
"negotiating.recorded",
f"已记录为「协商中」。已顺延三个工作日,{when}的9:00再次发起成交状态询问。",
f"已记录为「协商中」。已顺延 {hours_text} 个工作小时,将于 {when} 再次发起成交状态询问。",
followup_when=when,
followup_hours=hours_text,
ticket_no=no,
)
def _followup_month_day(raw: str) -> str:
"""把主账再问时刻收成「9月24日」。"""
"""把主账再问时刻收成「9月24日」(旧模板兼容)。"""
when = _followup_when_text(raw)
if "日" in when:
return when.split("日", 1)[0] + "日"
return when
def _followup_when_text(raw: str) -> str:
"""把主账再问时刻收成「9月24日15:30」。"""
from datetime import datetime
text = (raw or "").strip()
if not text:
return ""
for fmt, n in (("%Y-%m-%d %H:%M:%S", 19), ("%Y-%m-%d", 10)):
for fmt, n in (("%Y-%m-%d %H:%M:%S", 19), ("%Y-%m-%d %H:%M", 16), ("%Y-%m-%d", 10)):
try:
dt = datetime.strptime(text[:n], fmt)
return f"{dt.month}月{dt.day}日"
if n <= 10:
return f"{dt.month}月{dt.day}日"
return f"{dt.month}月{dt.day}日{dt.hour}:{dt.minute:02d}"
except ValueError:
continue
return ""