chore: 为 Admin 启动脚本增加热重载 (#13)

This commit is contained in:
chengma
2026-08-06 17:34:56 +08:00
parent 5a5c1f1f68
commit 7a6c647eda
4 changed files with 95 additions and 2 deletions
+14 -2
View File
@@ -67,6 +67,20 @@ go get github.com/xuri/excelize/v2@v2.9.1
## 3. 跑起来
推荐在仓库根目录运行热重载脚本:
```powershell
cd D:\chengma\cmautobuy
.\run_admin.bat
```
脚本第一次运行时会自动安装与 Go 1.23 兼容的
`github.com/air-verse/air@v1.61.7`,以后会直接使用已安装的固定版本。
保存 Go、HTML、CSS 或 JavaScript 文件后,Air 会自动重新编译并重启 Admin;
按 `Ctrl+C` 停止。
如果只想临时运行一次、不需要热重载,也可以:
```powershell
cd D:\chengma\cmautobuy\admin
go run .
@@ -76,8 +90,6 @@ go run .
**这个命令是安全的**:Admin 只管理数据,不会连手机、不会下单。放心随便跑。
改了代码要重启才生效(Go 不像 Python 那样改完就生效)。按 `Ctrl+C` 停掉再 `go run .`。
## 4. 你应该看到什么
左边(或顶部)是四个模块的导航: