From a0e2c7b267d2826b32cf7720703f545ff832f4bf Mon Sep 17 00:00:00 2001 From: root Date: Sun, 1 Mar 2026 09:26:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=A3=9E=E4=B9=A6?= =?UTF-8?q?=E6=B6=88=E6=81=AF=20emoji=20=E7=BC=96=E7=A0=81=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 json_encode 中使用 JSON_UNESCAPED_UNICODE 标志 - 修复 sendMessage() 方法中的 JSON 编码 - 修复 updateMessageCards() 方法中的 JSON 编码 - 解决飞书 API 报错 200621 (parse card json err) --- backend/app/service/FeishuNotificationService.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/app/service/FeishuNotificationService.php b/backend/app/service/FeishuNotificationService.php index 96223c2..ad6817c 100644 --- a/backend/app/service/FeishuNotificationService.php +++ b/backend/app/service/FeishuNotificationService.php @@ -563,7 +563,8 @@ class FeishuNotificationService $app = $this->getAppConfig(); $token = $this->getAccessToken(); - $content = json_encode(['card' => $card]); + // 使用 JSON_UNESCAPED_UNICODE 避免 emoji 被转义 + $content = json_encode(['card' => $card], JSON_UNESCAPED_UNICODE); error_log('📤 发送飞书消息: app_id=' . $app['app_id'] . ', feishu_user_id=' . $feishuUserId); error_log('📦 消息卡片: ' . json_encode($card, JSON_UNESCAPED_UNICODE)); @@ -713,7 +714,8 @@ class FeishuNotificationService "https://open.feishu.cn/open-apis/im/v1/messages/{$message->message_id}/update", [ 'msg_type' => 'interactive', - 'content' => json_encode(['card' => $updatedCard]), + // 使用 JSON_UNESCAPED_UNICODE 避免 emoji 被转义 + 'content' => json_encode(['card' => $updatedCard], JSON_UNESCAPED_UNICODE), ], [ 'Authorization: Bearer ' . $token,