1 Star 0 Fork 11

ruanhao/oh-container-deploy

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
WakeUpAll.ps1 3.27 KB
一键复制 编辑 原始数据 按行查看 历史
abing 提交于 2025-05-09 08:50 +08:00 . 新增唤醒
# 进行服务的唤醒,防止调用的时候报错,只相应,不追求接口成功
$configs = @(
@{ Name = "ApiManage"; Port = 8016; Type = 3; Url = "/api/SysNotice/PushMsg" }
@{ Name = "AuthCenterAPI"; Port = 8015; Type = 3; Url = "/api/Auth/GetUserToken" }
@{ Name = "Base"; Port = 8001; Type = 1; Url = "" }
@{ Name = "BaseAPI"; Port = 7001; Type = 3; Url = "/api/Auth/GetToken" }
@{ Name = "CIS"; Port = 8003; Type = 1; Url = "" }
@{ Name = "CISAPI"; Port = 7003; Type = 3; Url = "/api/Auth/GetToken" }
@{ Name = "EMR"; Port = 8005; Type = 1; Url = "" }
@{ Name = "EmrStatic"; Port = 8020; Type = 2; Url = "" }
@{ Name = "Herp"; Port = 8007; Type = 1; Url = "" }
@{ Name = "his.baseapi"; Port = 8017; Type = 3; Url = "/api/sysuser/GetSysUserPage" }
@{ Name = "MRMS"; Port = 8008; Type = 1; Url = "" }
@{ Name = "MRQC"; Port = 8009; Type = 1; Url = "" }
@{ Name = "OR"; Port = 8006; Type = 1; Url = "" }
@{ Name = "ORAPI"; Port = 7006; Type = 3; Url = "/api/Auth/GetToken" }
@{ Name = "PDS"; Port = 8004; Type = 1; Url = "" }
@{ Name = "PDSAPI"; Port = 7004; Type = 3; Url = "/api/Auth/GetToken" }
@{ Name = "Report"; Port = 8000; Type = 1; Url = "" }
@{ Name = "Sett"; Port = 8002; Type = 1; Url = "" }
@{ Name = "SettAPI"; Port = 7002; Type = 3; Url = "/api/Auth/GetToken" }
@{ Name = "Static"; Port = 8014; Type = 2; Url = "" }
@{ Name = "Union"; Port = 8018; Type = 1; Url = "" }
)
foreach ($site in $configs) {
$name = $site.Name
$port = $site.Port
$type = $site.Type
$urlPath = $site.Url
$baseUrl = "http://localhost:$port"
switch ($type) {
1 {
$url = "$baseUrl/"
try {
$response = Invoke-WebRequest -Uri $url -UseBasicParsing -TimeoutSec 5
Write-Host "✅ [$name] 网页访问成功: $url"
} catch {
Write-Warning "❌ [$name] 网页访问失败: $($_.Exception.Message)"
}
}
2 {
Write-Host "⏭ [$name] 是静态资源,跳过"
}
3 {
if ([string]::IsNullOrWhiteSpace($urlPath)) {
Write-Warning "⚠️ [$name] 接口地址为空,跳过"
continue
}
$fullUrl = "$baseUrl$urlPath"
try {
if ($name -eq "AuthCenterAPI") {
# POST 请求唤醒,不需要参数
$response = Invoke-RestMethod -Uri $fullUrl -Method Post -Body '{}' -ContentType "application/json" -TimeoutSec 5
Write-Host "✅ [$name] POST 请求成功: $fullUrl"
} else {
# 默认 GET 请求
$response = Invoke-WebRequest -Uri $fullUrl -UseBasicParsing -TimeoutSec 5
Write-Host "✅ [$name] GET 请求成功: $fullUrl"
}
} catch {
Write-Warning "❌ [$name] 接口请求失败: $($_.Exception.Message)"
}
}
default {
Write-Warning "❓ [$name] 未知类型: $type"
}
}
Start-Sleep -Seconds 1
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/dfyiliao/oh-container-deploy.git
git@gitee.com:dfyiliao/oh-container-deploy.git
dfyiliao
oh-container-deploy
oh-container-deploy
master

搜索帮助