Files
glz eb4f09e391 feat: 新增打印任务相关功能并完善服务配置
1. 调整回调响应的Code字段类型为object以兼容更多返回值
2. 为JournalDto新增Url和QuestionNo属性
3. 为JournalPageTaskOutput新增Task字段并完善注释
4. 新增打印工作服务的发布、安装卸载脚本与README文档
5. 调整项目配置,添加运行时标识与资源拷贝配置
6. 优化程序启动逻辑,修复工作目录与日志路径问题
7. 简化日志配置,移除多余的Hangfire与AI配置项
8. 完善期刊删除逻辑,关联删除相关子数据
9. 新增期刊发布时的书页任务排序与回调地址补全逻辑
2026-07-01 10:56:18 +08:00

36 lines
1.2 KiB
PowerShell

param(
[string]$ServiceName = "QYZH.InteractiveMagazine.PrintWorker",
[string]$DisplayName = "QYZH InteractiveMagazine PrintWorker",
[string]$Description = "InteractiveMagazine automatic dot-code print worker.",
[string]$PublishPath = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
)
$ErrorActionPreference = "Stop"
if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
throw "Please run this script in an elevated PowerShell window."
}
$exePath = Resolve-Path (Join-Path $PublishPath "QYZH.InteractiveMagazine.PrintWorker.exe")
$existing = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue
if ($existing) {
if ($existing.Status -ne "Stopped") {
Stop-Service -Name $ServiceName -Force
$existing.WaitForStatus("Stopped", "00:00:30")
}
sc.exe delete $ServiceName | Out-Null
Start-Sleep -Seconds 2
}
New-Service `
-Name $ServiceName `
-BinaryPathName "`"$exePath`"" `
-DisplayName $DisplayName `
-Description $Description `
-StartupType Automatic
Start-Service -Name $ServiceName
Get-Service -Name $ServiceName