This commit is contained in:
hu xiaotong
2025-07-02 16:12:52 +08:00
commit 0246bc7060
48 changed files with 460639 additions and 0 deletions

64
main.go Normal file
View File

@@ -0,0 +1,64 @@
package main
import (
"embed"
"github.com/wailsapp/wails/v2/pkg/logger"
"log"
"equipment-analyzer/internal/config"
"equipment-analyzer/internal/service"
"equipment-analyzer/internal/utils"
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/options"
)
//go:embed frontend/dist
var assets embed.FS
func main() {
// 初始化日志
newLogger := utils.NewLogger()
defer newLogger.Sync()
// 加载配置
cfg, err := config.Load()
if err != nil {
log.Fatal("Failed to load config:", err)
}
// 创建应用服务
app := service.NewApp(cfg, newLogger)
// 设置应用选项
appOptions := &options.App{
Title: "epic-luna",
Width: 1024,
Height: 768,
//Hidden: false,
BackgroundColour: &options.RGBA{R: 255, G: 255, B: 255, A: 1},
Assets: assets,
Menu: nil,
Logger: nil,
LogLevel: logger.DEBUG,
LogLevelProduction: logger.ERROR,
OnStartup: app.Startup,
OnDomReady: app.DomReady,
OnBeforeClose: app.BeforeClose,
OnShutdown: app.Shutdown,
Debug: options.Debug{
OpenInspectorOnStartup: true,
},
//EnableDefaultContext: true,
Bind: []interface{}{
app,
},
}
// 启动应用
err = wails.Run(appOptions)
if err != nil {
log.Fatal("Failed to start application:", err)
}
}