fix: 修复 CLI 环境下 request() 为 null 导致的错误
- 在 getDetailUrl() 方法中添加 CLI 环境检查 - CLI 环境使用默认域名 uniservice-mobile.hnxinyouhe.com
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
// 统一使用审批详情页,不再跳转到具体业务模块的详情页
|
||||
|
||||
Reference in New Issue
Block a user