优化代码结构,修复查询逻辑,添加构建脚本

This commit is contained in:
2025-08-09 16:17:41 +08:00
parent 4bbc05fe1f
commit 3782feaf85
8 changed files with 38 additions and 15 deletions

15
main.go
View File

@@ -4,6 +4,7 @@ import (
"fmt"
"log/slog"
"os"
"path/filepath"
"slices"
"zzman/actions"
"zzman/clients"
@@ -16,7 +17,14 @@ func main() {
// 初始化环境
slog.Debug("初始化环境变量")
err := godotenv.Load()
ex, err := os.Executable()
if err != nil {
panic(err)
}
exPath := filepath.Dir(ex)
file := filepath.Join(exPath, ".env")
println("加载环境变量文件:", file)
err = godotenv.Load(file)
if err != nil {
slog.Error(fmt.Errorf("初始化变量失败:%w", err).Error())
}
@@ -43,8 +51,9 @@ func main() {
var args actions.UpdateArgs
if len(os.Args) >= 3 {
slices.Contains(os.Args, "--mock")
args.Mock = true
if slices.Contains(os.Args, "--mock") {
args.Mock = true
}
}
err := actions.Update(model.DB, args)