修复工单PHP CLI同步问题 系统设置可以设置并发阈值

This commit is contained in:
root
2026-07-02 19:03:06 +08:00
parent 638b3c4032
commit c3223f026e
20 changed files with 1087 additions and 241 deletions
@@ -51,6 +51,7 @@ class SplitTicketSyncDispatchService
'queued' => $queued,
'skipped' => $skipped,
'failed' => $failed,
'phpCli' => $php,
]);
return [
@@ -130,13 +131,43 @@ class SplitTicketSyncDispatchService
private function resolvePhpBinary(): string
{
if (defined('PHP_BINARY') && PHP_BINARY !== '') {
return PHP_BINARY;
if (method_exists(SplitSyncConfigService::class, 'getCliPhpBinary')) {
return SplitSyncConfigService::getCliPhpBinary();
}
return $this->resolvePhpBinaryFallback();
}
/**
* 当 SplitSyncConfigService 未部署 getCliPhpBinary 时的兜底解析
*/
private function resolvePhpBinaryFallback(): string
{
if (defined('PHP_BINDIR') && PHP_BINDIR !== '') {
$candidate = rtrim(PHP_BINDIR, '/\\') . DIRECTORY_SEPARATOR . 'php';
if ($this->isUsableCliPhp($candidate)) {
return $candidate;
}
}
foreach (['/usr/bin/php', '/usr/local/bin/php'] as $candidate) {
if ($this->isUsableCliPhp($candidate)) {
return $candidate;
}
}
return 'php';
}
private function isUsableCliPhp(string $path): bool
{
if (stripos($path, 'fpm') !== false) {
return false;
}
if ($path === 'php') {
return true;
}
return is_file($path) && is_executable($path);
}
private function resolveThinkScript(): string
{
$root = $this->resolveRootPath();