From 27cf1a555f194d7e0447ab4fd04c8600ecba9b4b Mon Sep 17 00:00:00 2001 From: root Date: Sun, 1 Mar 2026 11:55:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BB=8E=E7=94=B3=E8=AF=B7=E4=BA=BA?= =?UTF-8?q?=E7=9A=84=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF=E4=B8=AD=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=85=AC=E5=8F=B8ID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit approval_order 表没有 company_id 字段,改为从申请人 的用户信息中获取公司ID来设置飞书应用配置 Co-Authored-By: Claude Opus 4.6 --- .../app/service/FeishuNotificationService.php | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/backend/app/service/FeishuNotificationService.php b/backend/app/service/FeishuNotificationService.php index 4d3a6bb..b016316 100644 --- a/backend/app/service/FeishuNotificationService.php +++ b/backend/app/service/FeishuNotificationService.php @@ -677,10 +677,19 @@ class FeishuNotificationService return true; } - // 获取订单以确定公司ID,设置飞书应用配置 + // 获取订单申请人信息,从用户中获取公司ID $order = \app\model\ApprovalOrder::find($orderId); - if ($order && $order->company_id) { - $this->setAppByUser($excludeUserId, $order->company_id); + $companyId = null; + if ($order) { + $applicant = \app\model\User::find($order->applicant_id); + if ($applicant && !empty($applicant->company_id)) { + $companyId = $applicant->company_id; + } + } + + // 如果获取到公司ID,设置飞书应用配置 + if ($companyId) { + $this->setAppByUser($excludeUserId, $companyId); } $token = $this->getAccessToken(); @@ -822,10 +831,19 @@ class FeishuNotificationService return true; } - // 获取订单以确定公司ID,设置飞书应用配置 + // 获取订单申请人信息,从用户中获取公司ID $order = \app\model\ApprovalOrder::find($orderId); - if ($order && $order->company_id) { - $this->setAppByUser($excludeUserId, $order->company_id); + $companyId = null; + if ($order) { + $applicant = \app\model\User::find($order->applicant_id); + if ($applicant && !empty($applicant->company_id)) { + $companyId = $applicant->company_id; + } + } + + // 如果获取到公司ID,设置飞书应用配置 + if ($companyId) { + $this->setAppByUser($excludeUserId, $companyId); } $token = $this->getAccessToken();