From a83d7bfd95e8394e52a16da5c7cd3cf6b0a1e47e Mon Sep 17 00:00:00 2001
From: xyc <jc_xiong@hotmail.com>
Date: 星期六, 03 十月 2026 12:37:19 +0800
Subject: [PATCH] feat(部署): 增加双击安装服务入口(install-service.cmd)并自动验证启动结果

---
 start-dev.ps1 |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/start-dev.ps1 b/start-dev.ps1
index 5dcf2ba..de2dca6 100644
--- a/start-dev.ps1
+++ b/start-dev.ps1
@@ -12,6 +12,19 @@
 $root = Split-Path -Parent $MyInvocation.MyCommand.Path
 $webDir = Join-Path $root 'traffic-audit-web'
 
+# ---------- 瀵嗛挜锛氫粠 Windows 鐢ㄦ埛鐜鍙橀噺琛ラ綈锛堢湡瀹炲�间笉钀芥枃浠讹級----------
+# 鑻ュ綋鍓� shell 鏄棫杩涚▼銆佹嬁涓嶅埌鏂拌鐨勫彉閲忥紝鍒欎粠娉ㄥ唽琛� HKCU\Environment 璇讳竴娆★紝
+# 渚涘悗绔瓙杩涚▼缁ф壙锛堥伩鍏�"瀵嗛挜涓嶅湪浠讳綍鏂囦欢閲屻�佸張璇讳笉鍒扮幆澧冨彉閲�"鐨勭┖妗o級銆�
+foreach ($name in @('TRAFFIC_DB_PASSWORD', 'DEEPSEEK_API_KEY', 'TRAFFIC_DB_URL', 'TRAFFIC_DB_USER', 'TRAFFIC_JWT_SECRET')) {
+  if (-not [Environment]::GetEnvironmentVariable($name, 'Process')) {
+    $val = [Environment]::GetEnvironmentVariable($name, 'User')
+    if ($val) {
+      [Environment]::SetEnvironmentVariable($name, $val, 'Process')
+      Write-Host "宸蹭粠鐢ㄦ埛鐜鍙橀噺杞藉叆 $name"
+    }
+  }
+}
+
 function Test-PortListening($port) {
   try {
     $c = Get-NetTCPConnection -LocalPort $port -State Listen -ErrorAction Stop

--
Gitblit v1.9.1