落地陆运私聊文字询价:选项核对后再建单查价,并按线路拉产品进群。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -104,9 +104,10 @@ def is_sales(ticket: object, sender_id: str) -> bool:
|
||||
|
||||
def is_product(ticket: object, sender_id: str, flow: Any = None) -> bool:
|
||||
"""
|
||||
产品岗:工单产品名单,或后台员工管理挂了产品·海运。
|
||||
产品岗:工单产品名单,或后台员工管理挂了对应业务线产品岗。
|
||||
|
||||
同一个人可以既是拉群销售又是产品。先当销售挡掉的话,自己报价群里会没反应。
|
||||
海运认 role_code=sea,陆运认 land。
|
||||
"""
|
||||
uid = (sender_id or "").strip()
|
||||
if not uid:
|
||||
@@ -115,7 +116,7 @@ def is_product(ticket: object, sender_id: str, flow: Any = None) -> bool:
|
||||
products = {str(x) for x in (view.get("product_ids") or view.get("productIds") or [])}
|
||||
if uid in products:
|
||||
return True
|
||||
if _staff_is_sea_product(flow, uid):
|
||||
if _staff_is_line_product(flow, uid, ticket):
|
||||
return True
|
||||
if is_sales(ticket, uid):
|
||||
return False
|
||||
@@ -125,8 +126,8 @@ def is_product(ticket: object, sender_id: str, flow: Any = None) -> bool:
|
||||
return uid in members
|
||||
|
||||
|
||||
def _staff_is_sea_product(flow: Any, wecom_id: str) -> bool:
|
||||
"""后台员工管理:role_code=sea 且能查到,才算产品岗。"""
|
||||
def _staff_is_line_product(flow: Any, wecom_id: str, ticket: object = None) -> bool:
|
||||
"""后台员工管理:本单 SEA 认 sea,LAND 认 land。"""
|
||||
book = getattr(flow, "ledger", None) if flow is not None else None
|
||||
finder = getattr(book, "get_staff_by_wecom_id", None) if book is not None else None
|
||||
if not callable(finder):
|
||||
@@ -137,7 +138,15 @@ def _staff_is_sea_product(flow: Any, wecom_id: str) -> bool:
|
||||
logger.exception("查产品岗失败 wecom=%s", wecom_id)
|
||||
return False
|
||||
role = str(row.get("roleCode") or row.get("role_code") or "").strip().lower()
|
||||
return role == "sea"
|
||||
view = ticket_view(ticket)
|
||||
line = str(view.get("business_line") or view.get("businessLine") or "").strip().upper()
|
||||
want = "land" if line == "LAND" else "sea"
|
||||
return role == want
|
||||
|
||||
|
||||
def _staff_is_sea_product(flow: Any, wecom_id: str) -> bool:
|
||||
"""兼容旧调用:无工单时按海运岗认。"""
|
||||
return _staff_is_line_product(flow, wecom_id, None)
|
||||
|
||||
|
||||
def filename_is_excel_pdf(name: str) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user