feat: 新增打印任务相关功能并完善服务配置
1. 调整回调响应的Code字段类型为object以兼容更多返回值 2. 为JournalDto新增Url和QuestionNo属性 3. 为JournalPageTaskOutput新增Task字段并完善注释 4. 新增打印工作服务的发布、安装卸载脚本与README文档 5. 调整项目配置,添加运行时标识与资源拷贝配置 6. 优化程序启动逻辑,修复工作目录与日志路径问题 7. 简化日志配置,移除多余的Hangfire与AI配置项 8. 完善期刊删除逻辑,关联删除相关子数据 9. 新增期刊发布时的书页任务排序与回调地址补全逻辑
This commit is contained in:
@ -0,0 +1,35 @@
|
||||
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
|
||||
@ -0,0 +1,28 @@
|
||||
param(
|
||||
[string]$Configuration = "Release",
|
||||
[string]$Output = ".\publish\win-x64",
|
||||
[switch]$SelfContained
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$projectPath = Join-Path $PSScriptRoot "..\QYZH.InteractiveMagazine.PrintWorker.csproj"
|
||||
$publishArgs = @(
|
||||
"publish",
|
||||
$projectPath,
|
||||
"-c", $Configuration,
|
||||
"-r", "win-x64",
|
||||
"-o", $Output
|
||||
)
|
||||
|
||||
if ($SelfContained) {
|
||||
$publishArgs += "--self-contained"
|
||||
$publishArgs += "true"
|
||||
} else {
|
||||
$publishArgs += "--self-contained"
|
||||
$publishArgs += "false"
|
||||
}
|
||||
|
||||
dotnet @publishArgs
|
||||
|
||||
Write-Host "PrintWorker published to: $Output"
|
||||
@ -0,0 +1,23 @@
|
||||
param(
|
||||
[string]$ServiceName = "QYZH.InteractiveMagazine.PrintWorker"
|
||||
)
|
||||
|
||||
$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."
|
||||
}
|
||||
|
||||
$existing = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue
|
||||
if (-not $existing) {
|
||||
Write-Host "Service not found: $ServiceName"
|
||||
return
|
||||
}
|
||||
|
||||
if ($existing.Status -ne "Stopped") {
|
||||
Stop-Service -Name $ServiceName -Force
|
||||
$existing.WaitForStatus("Stopped", "00:00:30")
|
||||
}
|
||||
|
||||
sc.exe delete $ServiceName | Out-Null
|
||||
Write-Host "Service deleted: $ServiceName"
|
||||
Reference in New Issue
Block a user