优化代码结构,修复查询逻辑,添加构建脚本
This commit is contained in:
15
main.go
15
main.go
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user