初始化询价智能体新仓:同步本地工程并排除密钥与 .env。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
linmianxun
2026-09-13 14:30:44 +08:00
co-authored by Cursor
commit 2a14def882
2621 changed files with 393165 additions and 0 deletions
+96
View File
@@ -0,0 +1,96 @@
# 发布并启动新主账 8180(仅 E:\wwwroot\inquiry-new);禁止动现网 8080 / C:\yutongda
$ErrorActionPreference = 'Stop'
$Root = 'E:\wwwroot\inquiry-new'
$Jar = Join-Path $Root 'jeecg-system-start-3.5.3.jar'
$LogDir = Join-Path $Root 'logs'
$IncomingJar = 'C:\Users\ytd_extdev_0903\incoming\jeecg-system-start-3.5.3.jar'
New-Item -ItemType Directory -Force -Path $Root, $LogDir | Out-Null
if (Test-Path $IncomingJar) {
Write-Output "=== replace jar from incoming ==="
Copy-Item $IncomingJar $Jar -Force
}
if (-not (Test-Path $Jar)) { throw "jar missing: $Jar" }
$ji = Get-Item $Jar
Write-Output "jar bytes=$($ji.Length) mtime=$($ji.LastWriteTime)"
# 加载 E:\wwwroot\.env
Get-Content 'E:\wwwroot\.env' | ForEach-Object {
$line = $_.Trim()
if (-not $line -or $line.StartsWith('#')) { return }
$i = $line.IndexOf('=')
if ($i -lt 1) { return }
$k = $line.Substring(0, $i).Trim()
$v = $line.Substring($i + 1).Trim()
if ($v.StartsWith('"') -and $v.EndsWith('"')) { $v = $v.Substring(1, $v.Length - 2) }
[Environment]::SetEnvironmentVariable($k, $v, 'Process')
Set-Item -Path "Env:$k" -Value $v
}
if (-not $env:YTD_REDIS_PASSWORD -and $env:REDIS_URL) {
if ($env:REDIS_URL -match 'redis://:([^@]+)@') {
$env:YTD_REDIS_PASSWORD = $Matches[1]
} elseif ($env:REDIS_URL -match 'redis://[^:]+:([^@]+)@') {
$env:YTD_REDIS_PASSWORD = $Matches[1]
}
}
if (-not $env:YTD_REDIS_HOST) { $env:YTD_REDIS_HOST = '127.0.0.1' }
$env:YTD_REDIS_HOST = '127.0.0.1'
$env:LEDGER_PORT = '8180'
Write-Host "MYSQL_DB=$env:MYSQL_DB MYSQL_HOST=$env:MYSQL_HOST LEDGER_PORT=$env:LEDGER_PORT"
# 只停 inquiry-new 的 8180,绝不碰 yutongda 8080
Get-CimInstance Win32_Process -Filter "Name='java.exe'" | ForEach-Object {
if ($_.CommandLine -and $_.CommandLine -like '*inquiry-new*jeecg-system-start*') {
Write-Host "stop pid=$($_.ProcessId)"
Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue
}
}
Get-NetTCPConnection -LocalPort 8180 -ErrorAction SilentlyContinue |
Select-Object -ExpandProperty OwningProcess -Unique |
ForEach-Object {
$p = Get-CimInstance Win32_Process -Filter "ProcessId=$_"
if ($p -and $p.CommandLine -like '*inquiry-new*') {
Stop-Process -Id $_ -Force -ErrorAction SilentlyContinue
}
}
Start-Sleep -Seconds 2
$Java = 'C:\yutongda\tools\jdk8\bin\java.exe'
if (-not (Test-Path $Java)) { throw "java missing $Java" }
$Out = Join-Path $LogDir 'stdout.log'
$Err = Join-Path $LogDir 'stderr.log'
$arg = @(
'-jar', $Jar,
'--spring.profiles.active=inquiry',
"--server.port=$env:LEDGER_PORT"
)
Write-Host "starting $Java $($arg -join ' ')"
$p = Start-Process -FilePath $Java -ArgumentList $arg -WorkingDirectory $Root -RedirectStandardOutput $Out -RedirectStandardError $Err -PassThru -WindowStyle Hidden
Write-Host "started pid=$($p.Id)"
# 等启动(最长约 90s)
$ok = $false
for ($i = 1; $i -le 18; $i++) {
Start-Sleep -Seconds 5
try {
$r = Invoke-WebRequest -Uri 'http://127.0.0.1:8180/jeecgboot/' -UseBasicParsing -TimeoutSec 5
Write-Host "health try=$i status=$($r.StatusCode)"
$ok = $true
break
} catch {
Write-Host "health try=$i pending"
}
}
if (-not $ok) {
Write-Host '--- stderr tail ---'
if (Test-Path $Err) { Get-Content $Err -Tail 50 }
throw 'ledger 8180 health failed'
}
# 确认现网 8080 仍在
$prod = Get-NetTCPConnection -LocalPort 8080 -State Listen -ErrorAction SilentlyContinue | Select-Object -First 1
if (-not $prod) { throw 'CRITICAL: prod 8080 down after start' }
Write-Output 'LEDGER_8180_OK'
Write-Output "PROD_8080_OK pid=$($prod.OwningProcess)"