From dcde90a498ba80d40f644ecac064e63b3e811d5d Mon Sep 17 00:00:00 2001 From: root Date: Sat, 28 Feb 2026 14:35:08 +0800 Subject: [PATCH] =?UTF-8?q?debug:=20=E5=A2=9E=E5=BC=BA=E8=87=AA=E5=AE=A1?= =?UTF-8?q?=E6=89=B9=E6=A3=80=E6=B5=8B=E6=97=A5=E5=BF=97=EF=BC=8C=E6=8E=92?= =?UTF-8?q?=E6=9F=A5=E4=B8=BA=E4=BB=80=E4=B9=88=E6=B2=A1=E6=9C=89=E7=94=9F?= =?UTF-8?q?=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/FeishuNotificationService.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/backend/app/service/FeishuNotificationService.php b/backend/app/service/FeishuNotificationService.php index 9bfb0c9..02e9a80 100644 --- a/backend/app/service/FeishuNotificationService.php +++ b/backend/app/service/FeishuNotificationService.php @@ -124,6 +124,10 @@ class FeishuNotificationService public function sendApprovalNotification(array $params): bool { $userId = $params['user_id'] ?? null; + $applicantId = $params['applicant_id'] ?? null; + + error_log("📧 sendApprovalNotification 被调用: user_id={$userId}, applicant_id=" . ($applicantId ?? 'null')); + if (!$userId) { error_log('❌ sendApprovalNotification: 缺少 user_id'); return false; @@ -144,14 +148,14 @@ class FeishuNotificationService } // 检查是否是申请人自己 - 发送文本消息而不是卡片 - $applicantId = $params['applicant_id'] ?? null; - error_log("🔍 自审批检查: applicant_id=" . ($applicantId ?? 'null') . ", user_id={$userId}, match=" . (($applicantId == $userId) ? 'true' : 'false')); + error_log("🔍 自审批检查前: applicant_id=" . var_export($applicantId, true) . ", user_id=" . var_export($userId, true)); if ($applicantId && (int)$applicantId === (int)$userId) { error_log("🔄 检测到自审批,发送文本通知而不是卡片"); return $this->sendTextNotification($feishuUserId, $params); } + error_log("📨 发送卡片消息: 不是自审批"); $card = $this->buildApprovalCard($params, $user->company_id); return $this->sendMessage($feishuUserId, $card); } catch (Exception $e) { @@ -342,7 +346,7 @@ class FeishuNotificationService 'size' => 'medium', 'value' => [ 'action_type' => 'approve', - 'order_id' => $orderId, + 'order_id' => (int)$orderId, ], ]; @@ -357,7 +361,7 @@ class FeishuNotificationService 'size' => 'medium', 'value' => [ 'action_type' => 'reject', - 'order_id' => $orderId, + 'order_id' => (int)$orderId, ], ]; }