From ebfac48c36b7dbbc91c0003b52c582bc0b2c9856 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 1 Mar 2026 14:17:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=87=AA=E5=AE=A1=E6=89=B9=E5=9C=BA?= =?UTF-8?q?=E6=99=AF=E5=8F=91=E9=80=81"=E5=B7=B2=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E9=80=9A=E8=BF=87"=E9=80=9A=E7=9F=A5=E5=8D=A1=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 自审批时发送纯通知卡片(只有查看详情按钮),而不是带审批操作按钮的可操作卡片。 Co-Authored-By: Claude Opus 4.6 --- .../app/service/FeishuNotificationService.php | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/backend/app/service/FeishuNotificationService.php b/backend/app/service/FeishuNotificationService.php index c2ab700..cdc6151 100644 --- a/backend/app/service/FeishuNotificationService.php +++ b/backend/app/service/FeishuNotificationService.php @@ -158,14 +158,25 @@ class FeishuNotificationService error_log("🔍 自审批检查前: applicant_id=" . var_export($applicantId, true) . ", user_id=" . var_export($userId, true)); if ($applicantId && (int)$applicantId === (int)$userId) { - error_log("🔄 检测到自审批,发送卡片通知"); - } else { - error_log("📨 发送卡片消息: 不是自审批"); - } + // 自审批场景:发送"已自动通过"的通知卡片 + error_log("🔄 检测到自审批,发送已自动通过的通知卡片"); - // 无论是否自审批,都发送卡片消息 - $card = $this->buildApprovalCard($params, $user->company_id); - $messageId = $this->sendMessage($feishuUserId, $card, $orderId, $nodeId, $userId); + $type = $params['type'] ?? '申请'; + $content = $params['content'] ?? ''; + + $systemParams = [ + 'title' => '已自动通过', + 'content' => "**申请类型**: {$type}\n\n{$content}\n\n_由于审批人与申请人是同一人,系统已自动通过该申请_", + 'url' => $params['url'] ?? '', + ]; + $card = $this->buildSystemCard($systemParams, $user->company_id); + $messageId = $this->sendMessage($feishuUserId, $card, $orderId, $nodeId, $userId); + } else { + // 正常审批场景:发送可操作的审批卡片 + error_log("📨 发送卡片消息: 不是自审批"); + $card = $this->buildApprovalCard($params, $user->company_id); + $messageId = $this->sendMessage($feishuUserId, $card, $orderId, $nodeId, $userId); + } if ($messageId && $orderId && $nodeId) { // 保存消息映射(包含公司ID和飞书应用ID)