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)