|
@@ -2,22 +2,22 @@ package models
|
|
|
|
|
|
import (
|
|
|
"eta/eta_report/utils"
|
|
|
+ "github.com/beego/beego/v2/client/orm"
|
|
|
_ "github.com/go-sql-driver/mysql"
|
|
|
+ _ "github.com/lib/pq"
|
|
|
"time"
|
|
|
-
|
|
|
- "github.com/beego/beego/v2/client/orm"
|
|
|
)
|
|
|
|
|
|
func init() {
|
|
|
// eta_report
|
|
|
- _ = orm.RegisterDataBase("default", "mysql", utils.MYSQL_URL)
|
|
|
+ _ = orm.RegisterDataBase("default", utils.DBDRIVER_NAME, utils.MYSQL_URL)
|
|
|
orm.SetMaxIdleConns("default", 50)
|
|
|
orm.SetMaxOpenConns("default", 100)
|
|
|
db, _ := orm.GetDB("default")
|
|
|
db.SetConnMaxLifetime(10 * time.Minute)
|
|
|
|
|
|
// eta_master
|
|
|
- _ = orm.RegisterDataBase("eta", "mysql", utils.MYSQL_URL_ETA)
|
|
|
+ _ = orm.RegisterDataBase("eta", utils.DBDRIVER_NAME, utils.MYSQL_URL_ETA)
|
|
|
orm.SetMaxIdleConns("eta", 50)
|
|
|
orm.SetMaxOpenConns("eta", 100)
|
|
|
etaDb, _ := orm.GetDB("eta")
|
|
@@ -25,7 +25,7 @@ func init() {
|
|
|
|
|
|
// crm_master
|
|
|
if utils.MYSQL_WEEKLY_URL != `` && utils.BusinessCode == utils.BusinessCodeRelease {
|
|
|
- _ = orm.RegisterDataBase("weekly", "mysql", utils.MYSQL_WEEKLY_URL)
|
|
|
+ _ = orm.RegisterDataBase("weekly", utils.DBDRIVER_NAME, utils.MYSQL_WEEKLY_URL)
|
|
|
orm.SetMaxIdleConns("weekly", 50)
|
|
|
orm.SetMaxOpenConns("weekly", 100)
|
|
|
weeklyDb, _ := orm.GetDB("weekly")
|