diff --git a/backend/app/service/ApprovalService.php b/backend/app/service/ApprovalService.php index 65c8a22..acc4f24 100644 --- a/backend/app/service/ApprovalService.php +++ b/backend/app/service/ApprovalService.php @@ -565,10 +565,16 @@ class ApprovalService // 如果没有配置,使用当前请求构建 if (!$baseUrl) { - // 检查反向代理的协议头 - $scheme = request()->header('x-forwarded-proto') ?? request()->header('x-scheme') ?? 'https'; - $host = request()->host(); - $baseUrl = $scheme . '://' . $host; + // 检查是否在 CLI 环境 + if (PHP_SAPI === 'cli' || !request()) { + // CLI 环境:使用默认域名 + $baseUrl = 'https://uniservice-mobile.hnxinyouhe.com'; + } else { + // Web 环境:检查反向代理的协议头 + $scheme = request()->header('x-forwarded-proto') ?? request()->header('x-scheme') ?? 'https'; + $host = request()->host(); + $baseUrl = $scheme . '://' . $host; + } } // 统一使用审批详情页,不再跳转到具体业务模块的详情页