main.go 821 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package main
  2. import (
  3. "Panel_development/app"
  4. "Panel_development/database"
  5. "Panel_development/global"
  6. "Panel_development/simple_zap"
  7. "context"
  8. )
  9. func init() {
  10. err := global.SetupSetting()
  11. if err != nil {
  12. simple_zap.WithCtx(context.Background()).Sugar().Warn(err, "配置文件读取失败")
  13. }
  14. err = global.SetupDBLink()
  15. if err != nil {
  16. simple_zap.WithCtx(context.Background()).Sugar().Warn(err, "数据库连接失败")
  17. }
  18. // 数据库迁移
  19. database.Migrate(global.DBLink)
  20. }
  21. // @title 面板开发
  22. // @version 1.0
  23. // @description 面板开发
  24. // @Host 127.0.0.1:8081
  25. // @BasePath /api
  26. //
  27. //go:generate swag init --parseDependency --parseDepth=6
  28. func main() {
  29. err := app.InitRouter()
  30. if err != nil {
  31. simple_zap.WithCtx(context.Background()).Sugar().Warn(err, "项目初始化失败")
  32. return
  33. }
  34. }