| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- package main
- import (
- _ "go.uber.org/automaxprocs"
- "go.uber.org/zap"
- "server/core"
- "server/global"
- "server/initialize"
- )
- //go:generate go env -w GO111MODULE=on
- //go:generate go env -w GOPROXY=https://goproxy.cn,direct
- //go:generate go mod tidy
- //go:generate go mod download
- // @title Gin-Vue-Admin Swagger API接口文档
- // @version v2.6.3
- // @description 使用gin+vue进行极速开发的全栈开发基础平台
- // @securityDefinitions.apikey ApiKeyAuth
- // @in header
- // @name x-token
- // @BasePath /
- // InitBackend initializes the Go backend (Viper, Zap, GORM, Gin) and starts the
- // HTTP server in a background goroutine. It does not block. Call this before
- // running the Wails application.
- func InitBackend() {
- global.GVA_VP = core.Viper()
- initialize.OtherInit()
- global.GVA_LOG = core.Zap()
- zap.ReplaceGlobals(global.GVA_LOG)
- global.GVA_DB = initialize.Gorm()
- initialize.Timer()
- initialize.DBList()
- if global.GVA_DB != nil {
- initialize.RegisterTables()
- db, _ := global.GVA_DB.DB()
- defer db.Close()
- }
- initialize.InitUHFDevices()
- go core.RunWindowsServer()
- }
- // main is retained for standalone (non-Wails) usage.
- func main() {
- InitBackend()
- // Block forever when running standalone.
- select {}
- }
|