空运群超时找不到航线成员时写成了「相关人员」。改为 @ 航线同事;销售超时只 @ 本单销售。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -164,7 +164,7 @@ def pick_mentions(
|
||||
"""
|
||||
本单这次应回而未回、需要被点名的人。
|
||||
|
||||
航线只盯群里航线岗;海运/陆运产品盯对应产品岗;销售三类只盯本单销售。
|
||||
航线只盯群里航线岗;海运/陆运产品盯对应产品岗;销售三类只盯本单销售,不点航线。
|
||||
不要询价机器人、不要群里其他人。
|
||||
"""
|
||||
kind = (wait_kind or "").strip()
|
||||
@@ -206,6 +206,48 @@ def pick_mentions(
|
||||
return out
|
||||
|
||||
|
||||
def mentions_for_role(
|
||||
rows: list[dict[str, Any]] | None,
|
||||
*,
|
||||
role_code: str,
|
||||
) -> list[dict[str, Any]]:
|
||||
"""
|
||||
从员工行里取出启用、有企微、有姓名的指定岗位。
|
||||
|
||||
空运群激活只记群号,协同成员经常是空的。超时巡检在群成员里找不到航线岗时,
|
||||
用本函数点名员工管理里的航线·空运,和进群摘要 @ 的是同一批人。
|
||||
不发消息、不写主账。
|
||||
"""
|
||||
want = (role_code or "").strip().lower()
|
||||
if not want:
|
||||
return []
|
||||
out: list[dict[str, Any]] = []
|
||||
seen: set[str] = set()
|
||||
for raw in rows or []:
|
||||
if not isinstance(raw, dict):
|
||||
continue
|
||||
role = str(raw.get("roleCode") or raw.get("role_code") or "").strip().lower()
|
||||
if role != want:
|
||||
continue
|
||||
status = str(raw.get("status") or "active").strip().lower()
|
||||
if status in {"disabled", "0", "停用", "inactive"}:
|
||||
continue
|
||||
uid = str(raw.get("wecomId") or raw.get("wecom_id") or "").strip()
|
||||
name = str(raw.get("name") or "").strip()
|
||||
if not uid or not name or uid in seen:
|
||||
continue
|
||||
seen.add(uid)
|
||||
out.append(
|
||||
{
|
||||
"wecomId": uid,
|
||||
"name": name,
|
||||
"roleCode": want,
|
||||
"notifyEventException": raw.get("notifyEventException", 0),
|
||||
}
|
||||
)
|
||||
return out
|
||||
|
||||
|
||||
def pick_app_targets(people: list[dict[str, Any]] | None) -> list[dict[str, Any]]:
|
||||
"""勾了「接收事件异常消息提醒」且绑了企微的人。"""
|
||||
out: list[dict[str, Any]] = []
|
||||
|
||||
Reference in New Issue
Block a user