From 103da81a5c4c6ee00c25178921418607d0fc4597 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 27 Feb 2026 22:12:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A7=BB=E9=99=A4=E7=A1=AC=E7=BC=96?= =?UTF-8?q?=E7=A0=81=E7=9A=84=E5=BC=80=E5=8F=91=E7=8E=AF=E5=A2=83=E5=9F=9F?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 使用动态域名配置(从 request 或 config 读取) - 添加 FEISHU_BASE_URL 环境变量支持 - 修复回调地址为当前站点域名 Co-Authored-By: Claude Opus 4.6 --- backend/app/controller/AuthController.php | 3 ++- backend/app/service/ApprovalService.php | 2 +- backend/app/service/BusinessTripService.php | 8 ++++---- backend/config/feishu_notification.php | 3 +++ 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/backend/app/controller/AuthController.php b/backend/app/controller/AuthController.php index 5c094f9..ddd951e 100644 --- a/backend/app/controller/AuthController.php +++ b/backend/app/controller/AuthController.php @@ -287,7 +287,8 @@ class AuthController extends BaseController ]); // 构建扫码登录 URL - $redirectUri = urlencode("https://xsm.dev.hnxinyouhe.com/login/callback"); + $baseUrl = config('feishu_notification.base_url') ?? request()->scheme() . '://' . request()->host(); + $redirectUri = urlencode($baseUrl . '/login/callback'); $authUrl = "https://passport.feishu.cn/suite/passport/oauth/authorize?client_id={$feishuApp->app_id}&redirect_uri={$redirectUri}&response_type=code&state={$loginSession->id}"; error_log("✅ 生成二维码会话: session_id={$loginSession->id}"); diff --git a/backend/app/service/ApprovalService.php b/backend/app/service/ApprovalService.php index 3c7149e..94984c1 100644 --- a/backend/app/service/ApprovalService.php +++ b/backend/app/service/ApprovalService.php @@ -502,7 +502,7 @@ class ApprovalService */ private function getDetailUrl(ApprovalOrder $order): string { - $baseUrl = 'https://xsm.dev.hnxinyouhe.com'; + $baseUrl = config('feishu_notification.base_url') ?? request()->scheme() . '://' . request()->host(); // 统一使用审批详情页,不再跳转到具体业务模块的详情页 return "{$baseUrl}/approval/detail/{$order->id}"; diff --git a/backend/app/service/BusinessTripService.php b/backend/app/service/BusinessTripService.php index 47a2bdf..9e951d8 100644 --- a/backend/app/service/BusinessTripService.php +++ b/backend/app/service/BusinessTripService.php @@ -296,7 +296,7 @@ class BusinessTripService } // 构建审批链接(统一使用审批详情页) - $approvalUrl = "https://xsm.dev.hnxinyouhe.com/approval/detail/{$approvalOrder->id}"; + $approvalUrl = "https://uniservice-mobile.hnxinyouhe.com/approval/detail/{$approvalOrder->id}"; // 构建内容 $content = "**出差原因**: {$businessTrip->reason}\n"; @@ -361,8 +361,8 @@ class BusinessTripService // 统一使用审批详情页 $detailUrl = $approvalOrder - ? "https://xsm.dev.hnxinyouhe.com/approval/detail/{$approvalOrder->id}" - : "https://xsm.dev.hnxinyouhe.com/approval/list"; + ? "https://uniservice-mobile.hnxinyouhe.com/approval/detail/{$approvalOrder->id}" + : "https://uniservice-mobile.hnxinyouhe.com/approval/list"; if ($action === 'approve') { $title = '出差申请已通过'; @@ -650,7 +650,7 @@ class BusinessTripService $notificationService = new \app\service\FeishuNotificationService(); // 统一使用审批详情页 - $detailUrl = "https://xsm.dev.hnxinyouhe.com/approval/detail/{$approvalOrder->id}"; + $detailUrl = "https://uniservice-mobile.hnxinyouhe.com/approval/detail/{$approvalOrder->id}"; // 获取审批人和抄送人 $formData = $approvalOrder->form_data ?? []; diff --git a/backend/config/feishu_notification.php b/backend/config/feishu_notification.php index 114b1fb..3667dc7 100644 --- a/backend/config/feishu_notification.php +++ b/backend/config/feishu_notification.php @@ -5,6 +5,9 @@ */ return [ + // 基础 URL(用于生成回调地址) + 'base_url' => env('FEISHU_BASE_URL') ?? null, + // 卡片模板配置 'templates' => [ // 审批通知模板