fix: 修复飞书消息 emoji 编码问题

- 在 json_encode 中使用 JSON_UNESCAPED_UNICODE 标志
- 修复 sendMessage() 方法中的 JSON 编码
- 修复 updateMessageCards() 方法中的 JSON 编码
- 解决飞书 API 报错 200621 (parse card json err)
This commit is contained in:
root
2026-03-01 09:26:19 +08:00
parent 7e88c28cc5
commit a0e2c7b267
@@ -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,