Commit 4fb31ddd by zhengqiuyun86

返回封装优化

parent 21e9de18
...@@ -111,6 +111,9 @@ func Init() { ...@@ -111,6 +111,9 @@ func Init() {
conf.MySql.User, conf.MySql.Password, conf.MySql.Host, conf.MySql.Port, conf.MySql.NameSpace)), &gorm.Config{ conf.MySql.User, conf.MySql.Password, conf.MySql.Host, conf.MySql.Port, conf.MySql.NameSpace)), &gorm.Config{
Logger: newLogger, Logger: newLogger,
}) })
if err != nil {
log.Error(fmt.Sprintf("%s connect error:%s", "Mysql server", err.Error()))
} else {
sqlDB, err := customerDb.DB() sqlDB, err := customerDb.DB()
if conf.MySql.MaxIdleConns == 0 { if conf.MySql.MaxIdleConns == 0 {
sqlDB.SetMaxIdleConns(10) sqlDB.SetMaxIdleConns(10)
...@@ -127,4 +130,6 @@ func Init() { ...@@ -127,4 +130,6 @@ func Init() {
} else { } else {
log.Info(fmt.Sprintf("%s connect success", "Mysql server")) log.Info(fmt.Sprintf("%s connect success", "Mysql server"))
} }
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment