fix: response_code持久化到数据库 + 工单客户端加tenant-id

1. wechat_service: save/get_response_code 改为内存+数据库双写,
   容器重启后边缘resolve仍能更新企微卡片
2. work_order_client: 请求头加 tenant-id,签名公式加 query_str 参数
3. config: WorkOrderConfig 新增 tenant_id 字段

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-13 13:37:34 +08:00
parent 2a9bf7d575
commit c2c272c298
3 changed files with 54 additions and 13 deletions

View File

@@ -81,6 +81,7 @@ class WorkOrderConfig:
base_url: str = "" # 工单系统地址,如 http://aiot-platform.viewsh.com:48080
app_id: str = "" # 应用ID
app_secret: str = "" # 应用密钥
tenant_id: str = "1" # 租户编号
timeout: int = 10 # 请求超时(秒)
enabled: bool = False
@@ -195,6 +196,7 @@ def load_settings() -> Settings:
base_url=os.getenv("WORK_ORDER_BASE_URL", ""),
app_id=os.getenv("WORK_ORDER_APP_ID", ""),
app_secret=os.getenv("WORK_ORDER_APP_SECRET", ""),
tenant_id=os.getenv("WORK_ORDER_TENANT_ID", "1"),
timeout=int(os.getenv("WORK_ORDER_TIMEOUT", "10")),
enabled=os.getenv("WORK_ORDER_ENABLED", "false").lower() == "true",
),