From 7cbd176a958b34e5a5ea6b2856fff734b1a6c46b Mon Sep 17 00:00:00 2001 From: 92451 <924518135@qq.com> Date: Fri, 30 Oct 2026 20:14:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=85=BC=E5=AE=B9=20Windows=20PowerShel?= =?UTF-8?q?l=20=E6=94=AF=E4=BB=98=E5=AE=9D=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../company-alipay-direct/install-daily-task.ps1 | 2 +- scripts/company-alipay-direct/run-alipay-daily.ps1 | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/company-alipay-direct/install-daily-task.ps1 b/scripts/company-alipay-direct/install-daily-task.ps1 index 5a6769ab..6326e59a 100644 --- a/scripts/company-alipay-direct/install-daily-task.ps1 +++ b/scripts/company-alipay-direct/install-daily-task.ps1 @@ -1,4 +1,4 @@ -#Requires -Version 5.1 +#Requires -Version 5.1 [CmdletBinding(SupportsShouldProcess = $true)] param( diff --git a/scripts/company-alipay-direct/run-alipay-daily.ps1 b/scripts/company-alipay-direct/run-alipay-daily.ps1 index 2b9dc25b..60556d86 100644 --- a/scripts/company-alipay-direct/run-alipay-daily.ps1 +++ b/scripts/company-alipay-direct/run-alipay-daily.ps1 @@ -1,4 +1,4 @@ -[CmdletBinding()] +[CmdletBinding()] param( [ValidatePattern('^\d{4}-\d{2}-\d{2}$')] [string] $Date, @@ -32,7 +32,10 @@ function Write-Log { if (-not (Test-Path -LiteralPath $secretFile -PathType Leaf)) { throw '缺少 runtime/private/敏感信息.md' } -$secret = Get-Content -LiteralPath $secretFile -Raw +$secret = [System.IO.File]::ReadAllText( + $secretFile, + [System.Text.UTF8Encoding]::new($false) +) $account = [regex]::Match($secret, '账号:([^\r\n]+)').Groups[1].Value.Trim() $accountShort = [regex]::Match($secret, '支付宝账户简称:([^\r\n]+)').Groups[1].Value.Trim() if ($account -notmatch '^\d{6,30}$') { @@ -57,7 +60,11 @@ if (-not [string]::IsNullOrWhiteSpace($InputFile)) { Write-Log ('支付宝导出失败:' + ($exportOutput.Trim() -replace "`r?`n", ' | ')) throw '支付宝账单导出失败;未写入财务台账' } - $state = Get-Content -LiteralPath (Join-Path $outputDir 'last-export.json') -Raw | ConvertFrom-Json + $statePath = Join-Path $outputDir 'last-export.json' + $state = [System.IO.File]::ReadAllText( + $statePath, + [System.Text.UTF8Encoding]::new($false) + ) | ConvertFrom-Json if (-not $state.ok -or [int] $state.rows -le 0) { Write-Log '支付宝账单为空;未写入财务台账' throw '支付宝账单为空;未写入财务台账' -- 2.47.2