|
@@ -21,9 +21,6 @@ import (
|
|
|
"eta_gn/eta_api/models/smart_report"
|
|
|
"eta_gn/eta_api/models/speech_recognition"
|
|
|
"eta_gn/eta_api/models/system"
|
|
|
- "eta_gn/eta_api/utils"
|
|
|
- "time"
|
|
|
-
|
|
|
_ "github.com/go-sql-driver/mysql"
|
|
|
|
|
|
"github.com/beego/beego/v2/client/orm"
|
|
@@ -31,63 +28,6 @@ import (
|
|
|
|
|
|
func init() {
|
|
|
|
|
|
- _ = orm.RegisterDataBase("default", "mysql", utils.MYSQL_URL)
|
|
|
- orm.SetMaxIdleConns("default", 50)
|
|
|
- orm.SetMaxOpenConns("default", 100)
|
|
|
-
|
|
|
- db, _ := orm.GetDB("default")
|
|
|
- db.SetConnMaxLifetime(10 * time.Minute)
|
|
|
-
|
|
|
- _ = orm.RegisterDataBase("rddp", "mysql", utils.MYSQL_URL_RDDP)
|
|
|
- orm.SetMaxIdleConns("rddp", 50)
|
|
|
- orm.SetMaxOpenConns("rddp", 100)
|
|
|
-
|
|
|
- report_db, _ := orm.GetDB("rddp")
|
|
|
- report_db.SetConnMaxLifetime(10 * time.Minute)
|
|
|
-
|
|
|
- _ = orm.RegisterDataBase("edb", "mysql", utils.MYSQL_URL_EDB)
|
|
|
- orm.SetMaxIdleConns("edb", 50)
|
|
|
- orm.SetMaxOpenConns("edb", 100)
|
|
|
-
|
|
|
- edb_db, _ := orm.GetDB("edb")
|
|
|
- edb_db.SetConnMaxLifetime(10 * time.Minute)
|
|
|
-
|
|
|
- _ = orm.RegisterDataBase("data", "mysql", utils.MYSQL_URL_DATA)
|
|
|
- orm.SetMaxIdleConns("data", 50)
|
|
|
- orm.SetMaxOpenConns("data", 100)
|
|
|
-
|
|
|
- data_db, _ := orm.GetDB("data")
|
|
|
- data_db.SetConnMaxLifetime(10 * time.Minute)
|
|
|
-
|
|
|
- _ = orm.RegisterDataBase("gl", "mysql", utils.MYSQL_URL_GL)
|
|
|
- orm.SetMaxIdleConns("gl", 50)
|
|
|
- orm.SetMaxOpenConns("gl", 100)
|
|
|
-
|
|
|
- gl, _ := orm.GetDB("gl")
|
|
|
- gl.SetConnMaxLifetime(10 * time.Minute)
|
|
|
-
|
|
|
- // 用户主库
|
|
|
- if utils.MYSQL_WEEKLY_URL != `` && (utils.BusinessCode == utils.BusinessCodeRelease || utils.BusinessCode == utils.BusinessCodeSandbox || utils.BusinessCode == utils.BusinessCodeDebug) {
|
|
|
- _ = orm.RegisterDataBase("weekly", "mysql", utils.MYSQL_WEEKLY_URL)
|
|
|
- orm.SetMaxIdleConns("weekly", 50)
|
|
|
- orm.SetMaxOpenConns("weekly", 100)
|
|
|
-
|
|
|
- weeklyDb, _ := orm.GetDB("weekly")
|
|
|
- weeklyDb.SetConnMaxLifetime(10 * time.Minute)
|
|
|
- }
|
|
|
-
|
|
|
- if utils.MYSQL_AI_URL != "" {
|
|
|
- _ = orm.RegisterDataBase("ai", "mysql", utils.MYSQL_AI_URL)
|
|
|
- orm.SetMaxIdleConns("ai", 50)
|
|
|
- orm.SetMaxOpenConns("ai", 100)
|
|
|
-
|
|
|
- weeklyDb, _ := orm.GetDB("ai")
|
|
|
- weeklyDb.SetConnMaxLifetime(10 * time.Minute)
|
|
|
- }
|
|
|
-
|
|
|
- orm.Debug = true
|
|
|
- orm.DebugLog = orm.NewLog(utils.Binlog)
|
|
|
-
|
|
|
//注册对象
|
|
|
orm.RegisterModel(
|
|
|
new(Classify),
|
|
@@ -187,9 +127,6 @@ func init() {
|
|
|
|
|
|
// 初始化因子指标系列
|
|
|
initFactorEdbSeries()
|
|
|
-
|
|
|
- // 初始化部分数据表变量(直接init会有顺序问题=_=!)
|
|
|
- afterInitTable()
|
|
|
}
|
|
|
|
|
|
// initSystem 系统表 数据表
|
|
@@ -592,15 +529,3 @@ func initFactorEdbSeries() {
|
|
|
new(data_manage.FactorEdbSeriesCalculateDataQjjs), // 因子指标系列-区间计算数据
|
|
|
)
|
|
|
}
|
|
|
-
|
|
|
-// afterInitTable
|
|
|
-// @Description: 初始化表结构的的后置操作
|
|
|
-// @author: Roc
|
|
|
-// @datetime 2024-07-01 13:31:09
|
|
|
-func afterInitTable() {
|
|
|
- // 初始化指标来源配置
|
|
|
- data_manage.InitEdbSourceVar()
|
|
|
-
|
|
|
- // 初始化是否启用mongo配置
|
|
|
- InitUseMongoConf()
|
|
|
-}
|