# AIGC Demo - 使用域名启动服务 Write-Host "========================================" -ForegroundColor Cyan Write-Host "AIGC Demo - 使用域名启动服务" -ForegroundColor Cyan Write-Host "========================================" -ForegroundColor Cyan Write-Host "" # 检查域名解析 Write-Host "检查hosts文件配置..." -ForegroundColor Yellow try { $pingResult = Test-NetConnection -ComputerName "test.yourdomain.com" -Port 80 -InformationLevel Quiet if (-not $pingResult) { Write-Host "[错误] 域名解析失败,请先配置hosts文件" -ForegroundColor Red Write-Host "请运行: .\update-hosts.ps1 或手动编辑hosts文件" -ForegroundColor Yellow Write-Host "" Write-Host "需要添加以下映射到 C:\Windows\System32\drivers\etc\hosts:" -ForegroundColor Yellow Write-Host "127.0.0.1 test.yourdomain.com" -ForegroundColor White Write-Host "127.0.0.1 api.yourdomain.com" -ForegroundColor White Write-Host "127.0.0.1 local.yourdomain.com" -ForegroundColor White Read-Host "按回车键退出" exit 1 } } catch { Write-Host "[错误] 无法检查域名解析" -ForegroundColor Red Read-Host "按回车键退出" exit 1 } Write-Host "[成功] 域名解析正常" -ForegroundColor Green Write-Host "" # 启动后端服务 Write-Host "启动后端服务 (api.yourdomain.com:8080)..." -ForegroundColor Yellow Start-Process -FilePath "cmd" -ArgumentList "/k", "cd /d $PWD && mvn spring-boot:run" -WindowStyle Normal Write-Host "等待后端服务启动..." -ForegroundColor Yellow Start-Sleep -Seconds 10 # 启动前端服务 Write-Host "启动前端服务 (test.yourdomain.com:5173)..." -ForegroundColor Yellow Start-Process -FilePath "cmd" -ArgumentList "/k", "cd /d $PWD\frontend && npm run dev" -WindowStyle Normal Write-Host "" Write-Host "========================================" -ForegroundColor Cyan Write-Host "服务启动完成!" -ForegroundColor Green Write-Host "========================================" -ForegroundColor Cyan Write-Host "前端地址: http://test.yourdomain.com:5173" -ForegroundColor Cyan Write-Host "后端地址: http://api.yourdomain.com:8080" -ForegroundColor Cyan Write-Host "API地址: http://api.yourdomain.com:8080/api" -ForegroundColor Cyan Write-Host "========================================" -ForegroundColor Cyan Write-Host "" Read-Host "按回车键退出"