Files
Suda 1d67fda9d5 backend: 交付网站后端 + 本地自助管理后台 + 测试工程(已脱敏)
范围由店主圈定:网页后端 / 自助后端、本地的自助管理后台、
用于测试的 Blender 工程、以及部署层的反代片段。

出站纪律:所有指向真实环境的值(域名/端口/盘符路径/IP/账户名)已替换为占位;
代码里本来就没有硬编码凭据(令牌走文件与环境变量)。
Blender 工程因内嵌绝对路径,做了等长替换(文件字节数未变,结构完好)。

两份交接文档各含《我们的思路与方法》,并要求对方回:
问题分析 + 改正意见 + 他改了什么(含是否动到接口/字段/数据格式)。
2026-10-05 18:52:33 +08:00

54 lines
2.4 KiB
PowerShell
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
# 打包留档 —— 一键把「在线订单」压成带日期的 zip,方便传网盘
# ⚠️ 本文件含中文,必须存成 UTF-8 **带 BOM**(PowerShell 5.1 不认无 BOM 的 UTF-8)
param([switch]$NoPause) # -NoPause:非交互场景(远程测试)用
$ErrorActionPreference = 'Stop'
$ARCH = '<ARCHIVE_DIR>'
$OUT = '<ARCHIVE_DIR>'
$KEEP = 3 # 只留最近 3 个包,别把盘撑满
if (-not (Test-Path $ARCH)) { Write-Host "找不到留档目录:$ARCH"; exit 1 }
New-Item -ItemType Directory -Force -Path $OUT | Out-Null
# 先算大小,让金钻心里有数
$files = @(Get-ChildItem -Path $ARCH -Recurse -File -ErrorAction SilentlyContinue)
if ($files.Count -eq 0) { Write-Host "留档目录还是空的,没有要打包的。"; exit 0 }
$mb = [math]::Round((($files | Measure-Object -Property Length -Sum).Sum)/1MB, 1)
$stamp = Get-Date -Format 'yyyyMMdd_HHmmss'
$zip = Join-Path $OUT ("在线订单_$stamp.zip")
Write-Host "准备打包:$($files.Count) 个文件 / $mb MB"
Write-Host "输出:$zip"
Write-Host ""
# ⚠️ PNG 本身已是压缩数据,再压省不了多少,用 Optimal 纯烧时间(实测 35MB 花了 4 分半)。
# Fastest 快得多,体积几乎一样 —— 金钻 9-30:「压缩率不高的话就亏」。
$t0 = Get-Date
Compress-Archive -Path $ARCH -DestinationPath $zip -CompressionLevel Fastest -Force
$sec = [math]::Round(((Get-Date) - $t0).TotalSeconds, 1)
$zmb = [math]::Round((Get-Item $zip).Length/1MB, 1)
$ratio = if ($mb -gt 0) { [math]::Round(100*$zmb/$mb) } else { 0 }
$saved = if ($mb -gt 0) { [math]::Round(100 - $ratio) } else { 0 }
Write-Host "打包完成:$zmb MB(原 $mb MB,省 $saved%) 用了 $sec 秒"
if ($saved -lt 15) {
Write-Host " ⚠️ 这次省得不多 —— 图本来就是压缩过的。"
Write-Host " 打包主要是为了**把一堆文件变成一个**,方便整个拖网盘。"
}
# 清老包,只留最近 KEEP 个
$old = @(Get-ChildItem -Path $OUT -Filter '在线订单_*.zip' |
Sort-Object LastWriteTime -Descending | Select-Object -Skip $KEEP)
foreach ($f in $old) { Write-Host "清掉旧包:$($f.Name)"; Remove-Item $f.FullName -Force }
Write-Host ""
Write-Host "把这个文件拖进网盘就行 —— 上面那行就是路径:"
Write-Host $zip
Write-Host ""
if (-not $NoPause) {
Write-Host "按任意键关闭…"
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
}