fix: 卡片终态改用button.replace_name,不重绘整张卡片

- 终态更新改用 button.replace_name 方式,仅替换按钮文案为不可点击状态
- 原卡片告警信息保持不变,不再重绘整张卡片
- step2 处理中状态 desc_color 改为蓝色(1)表示进行中
- 边缘自动结单:用发送时保存的response_code直接更新卡片(72h有效)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-13 10:23:51 +08:00
parent f7a69892f6
commit 2a9bf7d575

View File

@@ -260,7 +260,7 @@ class WeChatService:
"task_id": alarm_id,
"source": {
"desc": "AI安防告警 - 处理中",
"desc_color": 0,
"desc_color": 1,
},
"main_title": {
"title": f"已接单 - {operator_name}" if operator_name else "已接单",
@@ -305,7 +305,12 @@ class WeChatService:
action: str,
operator_name: str = "",
) -> bool:
"""更新卡片到终态(按钮变灰 + 显示最终结果)"""
"""
更新卡片到终态(仅替换按钮文案,不重绘整张卡片)
使用 button.replace_name 方式更新,原卡片内容保持不变,
按钮变为不可点击状态并显示处理结果文案。
"""
if not self._enabled:
return False
@@ -324,20 +329,8 @@ class WeChatService:
"userids": user_ids,
"agentid": self.agent_id_int,
"response_code": response_code,
"template_card": {
"card_type": "button_interaction",
"task_id": alarm_id,
"main_title": {
"title": replace_text,
},
"sub_title_text": f"操作人:{operator_name}" if operator_name else "",
"button_list": [
{
"text": replace_text,
"style": 3,
"key": f"done_{alarm_id}",
},
],
"button": {
"replace_name": replace_text,
},
}