fix: 自审批场景发送"已自动通过"通知卡片

自审批时发送纯通知卡片(只有查看详情按钮),而不是带审批操作按钮的可操作卡片。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
root
2026-03-01 14:17:52 +08:00
parent 9ffb05bb49
commit ebfac48c36
@@ -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)