refactor(lead): 退役 notify_wecom 8800 全员群推送(只保留 notify_boss DM)
ci/woodpecker/push/main Pipeline was successful
ci/woodpecker/push/main Pipeline was successful
- 删除 notify_wecom()(JSON body 打 8800/send,中继只解析 form-encoded,从未发出过消息)与吞异常的 except: pass - 客户咨询通知唯一通道:notify_boss 推任总 DM(经 ai-cs 分流) - 去掉随之无用的 urllib.request 导入 - 零行为变更:删的是从不生效的代码;防止后人「修成 form-encoded」把客户个人信息推进全员群 关联决策:ASK-20261021-09(任总 2026-10-22 11:16:8800 仅限 notice_class=content) 派单:finance-20261022-cma-lead-retire-8800-project(父任务 yanxue-20261022-relay-8800-koujing-finance)
This commit is contained in:
+3
-24
@@ -1,7 +1,7 @@
|
||||
"""AI获客 - 客户咨询接口"""
|
||||
from fastapi import APIRouter, HTTPException
|
||||
from pydantic import BaseModel
|
||||
import json, os, datetime, subprocess, urllib.request
|
||||
import json, os, datetime, subprocess
|
||||
|
||||
router = APIRouter(prefix="/api/cma/lead", tags=["AI获客"])
|
||||
|
||||
@@ -18,26 +18,6 @@ class LeadRequest(BaseModel):
|
||||
requirement: str = ""
|
||||
source: str = "sxbh.ltd"
|
||||
|
||||
def notify_wecom(name, phone, requirement, source):
|
||||
"""推送到企微全员群"""
|
||||
msg = {
|
||||
"msgtype": "markdown",
|
||||
"markdown": {
|
||||
"content": f"## 🔔 新客户咨询\n**姓名**: {name}\n**电话**: {phone}\n**需求**: {requirement}\n**来源**: {source}\n**时间**: {datetime.datetime.now().strftime('%Y-%m-%d %H:%M')}"
|
||||
}
|
||||
}
|
||||
try:
|
||||
data = json.dumps(msg).encode('utf-8')
|
||||
req = urllib.request.Request(
|
||||
"http://127.0.0.1:8800/send",
|
||||
data=data,
|
||||
headers={"Content-Type": "application/json"},
|
||||
method="POST"
|
||||
)
|
||||
urllib.request.urlopen(req, timeout=5)
|
||||
except:
|
||||
pass # 通知失败不影响主流程
|
||||
|
||||
def notify_boss(name, phone, requirement):
|
||||
"""额外推给任总(经 ai-cs 实盘分流脚本;失败不影响主流程)"""
|
||||
try:
|
||||
@@ -66,9 +46,8 @@ def create_lead(data: LeadRequest):
|
||||
with open(f"{log_dir}/leads.json", "a") as f:
|
||||
f.write(json.dumps(record, ensure_ascii=False) + "\n")
|
||||
|
||||
# 异步推送企微通知
|
||||
notify_wecom(data.name, data.phone, data.requirement, data.source)
|
||||
# 加性:额外推给任总 DM(口径与 ai-cs 客服分流一致)
|
||||
# 客户咨询通知唯一通道:推任总 DM(经 ai-cs 分流);不再推 8800 全员群
|
||||
# (2026-10-22 裁定:8800 仅限内容类群发,客户线索含个人信息,不得进全员群)
|
||||
notify_boss(data.name, data.phone, data.requirement)
|
||||
|
||||
return {"success": True, "message": "咨询已提交,我们将在30分钟内联系您"}
|
||||
|
||||
Reference in New Issue
Block a user