This commit is contained in:
hailin 2025-06-22 10:44:01 +08:00
parent 6693a47c2d
commit 69052faa7a
2 changed files with 21 additions and 19 deletions

View File

@ -33,7 +33,8 @@ type Controller struct {
func NewController(cfg *config.Config) *Controller { func NewController(cfg *config.Config) *Controller {
var err error var err error
var my, pg *sqlca.Engine //var my, pg *sqlca.Engine
var my *sqlca.Engine
my, err = sqlca.NewEngine(cfg.DSN) my, err = sqlca.NewEngine(cfg.DSN)
if err != nil { if err != nil {
log.Panic("MySQL source [%s] connect error [%s]", cfg.DSN, err.Error()) log.Panic("MySQL source [%s] connect error [%s]", cfg.DSN, err.Error())
@ -41,22 +42,22 @@ func NewController(cfg *config.Config) *Controller {
} }
my.Debug(cfg.Debug) //SQL调试日志 my.Debug(cfg.Debug) //SQL调试日志
my.SlowQuery(true, 800) //慢查询告警 my.SlowQuery(true, 800) //慢查询告警
pg, err = sqlca.NewEngine(cfg.Postgresql) // pg, err = sqlca.NewEngine(cfg.Postgresql)
if err != nil { // if err != nil {
log.Panic(" Postgresql source [%s] connect error [%s]", cfg.Postgresql, err.Error()) // log.Panic(" Postgresql source [%s] connect error [%s]", cfg.Postgresql, err.Error())
return nil // return nil
} // }
pg.Debug(cfg.Debug) //SQL调试日志 // pg.Debug(cfg.Debug) //SQL调试日志
pg.SlowQuery(true, 800) //慢查询告警 // pg.SlowQuery(true, 800) //慢查询告警
return &Controller{ return &Controller{
cfg: cfg, cfg: cfg,
BizCore: core.NewBizCore(cfg, my), BizCore: core.NewBizCore(cfg, my),
CommonCore: core.NewCommonCore(cfg, my), CommonCore: core.NewCommonCore(cfg, my),
PlatformCore: core.NewPlatformCore(cfg, my), PlatformCore: core.NewPlatformCore(cfg, my),
CustomerCore: core.NewCustomerCore(cfg, my), CustomerCore: core.NewCustomerCore(cfg, my),
DeployCore: core.NewDeployCore(cfg, my), DeployCore: core.NewDeployCore(cfg, my),
GatewayCore: core.NewGatewayCore(cfg, my), GatewayCore: core.NewGatewayCore(cfg, my),
SchedulerCore: core.NewSchedulerCore(cfg, my, pg), //SchedulerCore: core.NewSchedulerCore(cfg, my, pg),
DeployProgressPool: ws.NewWebSocketPool(), DeployProgressPool: ws.NewWebSocketPool(),
} }
} }

View File

@ -1,15 +1,16 @@
package core package core
import ( import (
"github.com/civet148/log"
"github.com/civet148/sqlca/v2"
"github.com/go-co-op/gocron"
"intent-system/pkg/config" "intent-system/pkg/config"
"intent-system/pkg/dal/dao" "intent-system/pkg/dal/dao"
"intent-system/pkg/dal/models" "intent-system/pkg/dal/models"
"intent-system/pkg/email" "intent-system/pkg/email"
"intent-system/pkg/utils" "intent-system/pkg/utils"
"time" "time"
"github.com/civet148/log"
"github.com/civet148/sqlca/v2"
"github.com/go-co-op/gocron"
) )
const ( const (