落地海运私聊文字询价全流程,海运多项费用改走文本明细,避免企微卡片引用条截断。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -102,10 +102,20 @@ class HttpLedger:
|
||||
return {"ok": False, "found": False, "owned": False, "work_order_no": work_order_no}
|
||||
return out
|
||||
|
||||
def query_tms(self, *, work_order_no: str, facts: dict[str, str]) -> dict[str, Any]:
|
||||
def query_tms(
|
||||
self,
|
||||
*,
|
||||
work_order_no: str,
|
||||
facts: dict[str, str],
|
||||
business_line: str = "",
|
||||
) -> dict[str, Any]:
|
||||
body: dict[str, Any] = {"work_order_no": work_order_no, "facts": facts}
|
||||
line = (business_line or str((facts or {}).get("业务线") or "")).strip()
|
||||
if line:
|
||||
body["businessLine"] = line
|
||||
out = self._post(
|
||||
"/inquiry/agent/tms/query",
|
||||
{"work_order_no": work_order_no, "facts": facts},
|
||||
body,
|
||||
idem=f"tms:{work_order_no}",
|
||||
)
|
||||
if "classification" not in out and not out.get("ok"):
|
||||
@@ -182,3 +192,72 @@ class HttpLedger:
|
||||
if not out.get("ok") and out.get("status"):
|
||||
out["ok"] = True
|
||||
return out if out.get("ok") else {"ok": False, "error": out.get("error") or "transition_failed"}
|
||||
|
||||
def match_sea_staff(self, *, origin: str, destination: str) -> list[dict[str, Any]]:
|
||||
"""主账按线路返回启用的海运产品岗。"""
|
||||
out = self._post(
|
||||
"/inquiry/agent/staff/matchSea",
|
||||
{"origin": origin, "destination": destination},
|
||||
)
|
||||
rows = out.get("staff") or out.get("result") or []
|
||||
if isinstance(rows, list):
|
||||
return [dict(x) for x in rows if isinstance(x, dict)]
|
||||
return []
|
||||
|
||||
def get_staff_by_wecom_id(self, *, wecom_id: str) -> dict[str, Any]:
|
||||
out = self._post("/inquiry/agent/staff/byWecom", {"wecomId": wecom_id})
|
||||
if out.get("name") or out.get("wecomId"):
|
||||
return out
|
||||
return {}
|
||||
|
||||
def find_staff_by_name(self, *, name: str) -> dict[str, Any]:
|
||||
"""按后台员工姓名取企微 userid。会话存档账号「询价机器人」走这里。"""
|
||||
out = self._post("/inquiry/agent/staff/byName", {"name": name})
|
||||
if out.get("name") or out.get("wecomId"):
|
||||
return out
|
||||
return {}
|
||||
|
||||
def bind_collab_group(
|
||||
self,
|
||||
*,
|
||||
work_order_no: str,
|
||||
chat_id: str,
|
||||
member_ids: list[str],
|
||||
product_names: list[str] | None = None,
|
||||
) -> dict[str, Any]:
|
||||
out = self._post(
|
||||
"/inquiry/agent/ticket/bindCollabGroup",
|
||||
{
|
||||
"workOrderNo": work_order_no,
|
||||
"chatId": chat_id,
|
||||
"memberIds": member_ids,
|
||||
"productNames": product_names or [],
|
||||
},
|
||||
idem=f"bind-group:{work_order_no}",
|
||||
)
|
||||
out.setdefault("ok", bool(out.get("chat_id") or out.get("chatId")))
|
||||
return out
|
||||
|
||||
def patch_collab_facts(
|
||||
self,
|
||||
*,
|
||||
work_order_no: str,
|
||||
facts: dict[str, str],
|
||||
sender_id: str = "",
|
||||
) -> dict[str, Any]:
|
||||
return self._post(
|
||||
"/inquiry/agent/ticket/patchCollabFacts",
|
||||
{
|
||||
"workOrderNo": work_order_no,
|
||||
"facts": facts,
|
||||
"senderId": sender_id,
|
||||
},
|
||||
idem=f"collab-facts:{work_order_no}:{sorted(facts)}",
|
||||
)
|
||||
|
||||
def find_by_collab_chat(self, *, chat_id: str) -> dict[str, Any] | None:
|
||||
"""用协同群 chat_id 找回工单。对不上返回 None。"""
|
||||
out = self._post("/inquiry/agent/ticket/byCollabChat", {"chatId": chat_id})
|
||||
if not out.get("found") and not out.get("work_order_no"):
|
||||
return None
|
||||
return out
|
||||
|
||||
Reference in New Issue
Block a user