elderly-health-platform/dev/start-all.ps1
2026-10-16 20:17:14 +08:00

58 lines
2.6 KiB
PowerShell
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# elderly-health-platform 本地一键启动:Redis(6380) + yudao-server(48080) + Vue3 管理端(48081)
# 用法:powershell -ExecutionPolicy Bypass -File .\dev\start-all.ps1
$ProjectRoot = Split-Path -Parent $PSScriptRoot
$ToolsRoot = 'D:\liwenjie-codex\_tools'
$RedisDir = Join-Path $ToolsRoot 'redis-5.0.14.1'
$JavaExe = 'D:\JDK\bin\java.exe'
$LogDir = Join-Path $ToolsRoot 'logs'
New-Item -ItemType Directory -Force -Path $LogDir | Out-Null
function Test-Port([int]$Port) {
return [bool](netstat -ano | Select-String 'LISTENING' | Select-String ":$Port\s")
}
# 1. Redis 6380(专用实例,不影响 Old_People_Recovery 的 6379)
if (-not (Test-Port 6380)) {
Write-Host '[1/3] 启动 Redis (6380) ...'
Start-Process -FilePath (Join-Path $RedisDir 'redis-server.exe') `
-ArgumentList 'redis-elderly-6380.conf' `
-WorkingDirectory $RedisDir -WindowStyle Hidden
Start-Sleep -Seconds 2
} else { Write-Host '[1/3] Redis 6380 已在运行' }
# 2. 后端 yudao-server
if (-not (Test-Port 48080)) {
Write-Host '[2/3] 启动 yudao-server (48080) ...'
Start-Process -FilePath $JavaExe `
-ArgumentList '-jar', (Join-Path $ProjectRoot 'yudao-server\target\yudao-server.jar') `
-WorkingDirectory $ProjectRoot `
-RedirectStandardOutput (Join-Path $LogDir 'backend.out.log') `
-RedirectStandardError (Join-Path $LogDir 'backend.err.log') -WindowStyle Hidden
Write-Host ' (首次启动约需 20-40 秒)'
} else { Write-Host '[2/3] yudao-server 已在运行' }
# 3. Vue3 管理端
if (-not (Test-Port 48081)) {
Write-Host '[3/4] 启动 Vue3 管理端 (48081) ...'
Start-Process -FilePath 'cmd.exe' `
-ArgumentList '/c', "pnpm dev > `"$LogDir\frontend.out.log`" 2>&1" `
-WorkingDirectory (Join-Path $ProjectRoot 'yudao-ui-admin-vue3') -WindowStyle Hidden
} else { Write-Host '[3/4] Vue3 管理端已在运行' }
# 4. 移动端 App(uni-app H5)
if (-not (Test-Port 48082)) {
Write-Host '[4/4] 启动移动端 App (48082) ...'
Start-Process -FilePath 'cmd.exe' `
-ArgumentList '/c', "pnpm dev:h5 > `"$LogDir\app.out.log`" 2>&1" `
-WorkingDirectory (Join-Path $ProjectRoot 'elderly-health-app') -WindowStyle Hidden
} else { Write-Host '[4/4] 移动端 App 已在运行' }
Start-Sleep -Seconds 3
Write-Host ''
Write-Host '访问地址:'
Write-Host ' 移动端 App(H5) http://localhost:48082 (账号 13800000000 / admin123)'
Write-Host ' 管理端 Web http://localhost:48081 (账号 admin / admin123,租户:芋道源码)'
Write-Host ' 后端 API http://localhost:48080'
Write-Host ' 接口文档 http://localhost:48080/doc.html'