From ea10bdb1386f635763b65ce4a39855d3b8f3535c Mon Sep 17 00:00:00 2001 From: root Date: Sat, 28 Feb 2026 14:12:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Drequest()->scheme()?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E4=B8=8D=E5=AD=98=E5=9C=A8=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ApprovalService.getDetailUrl: 改用 request()->isSecure() - AuthController.qrcodeLogin: 改用 request()->isSecure() --- backend/app/controller/AuthController.php | 7 ++++++- backend/app/service/ApprovalService.php | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/backend/app/controller/AuthController.php b/backend/app/controller/AuthController.php index 79b6f7f..b5cd114 100644 --- a/backend/app/controller/AuthController.php +++ b/backend/app/controller/AuthController.php @@ -287,7 +287,12 @@ class AuthController extends BaseController ]); // 构建扫码登录 URL(使用数据库中配置的回调地址) - $callbackUrl = $feishuApp->mobile_callback_url ?? request()->scheme() . '://' . request()->host() . '/login/callback'; + if ($feishuApp->mobile_callback_url) { + $callbackUrl = $feishuApp->mobile_callback_url; + } else { + $scheme = request()->isSecure() ? 'https' : 'http'; + $callbackUrl = $scheme . '://' . request()->host() . '/login/callback'; + } $redirectUri = urlencode($callbackUrl); $authUrl = "https://passport.feishu.cn/suite/passport/oauth/authorize?client_id={$feishuApp->app_id}&redirect_uri={$redirectUri}&response_type=code&state={$loginSession->id}"; diff --git a/backend/app/service/ApprovalService.php b/backend/app/service/ApprovalService.php index 94984c1..ecd6a81 100644 --- a/backend/app/service/ApprovalService.php +++ b/backend/app/service/ApprovalService.php @@ -502,7 +502,13 @@ class ApprovalService */ private function getDetailUrl(ApprovalOrder $order): string { - $baseUrl = config('feishu_notification.base_url') ?? request()->scheme() . '://' . request()->host(); + $baseUrl = config('feishu_notification.base_url'); + + // 如果没有配置,使用当前请求构建 + if (!$baseUrl) { + $scheme = request()->isSecure() ? 'https' : 'http'; + $baseUrl = $scheme . '://' . request()->host(); + } // 统一使用审批详情页,不再跳转到具体业务模块的详情页 return "{$baseUrl}/approval/detail/{$order->id}";