|
@@ -34,42 +34,42 @@ import (
|
|
|
"eta/eta_api/utils"
|
|
|
"time"
|
|
|
|
|
|
- _ "github.com/go-sql-driver/mysql"
|
|
|
-
|
|
|
"github.com/beego/beego/v2/client/orm"
|
|
|
+ _ "github.com/go-sql-driver/mysql"
|
|
|
+ _ "github.com/lib/pq"
|
|
|
)
|
|
|
|
|
|
func init() {
|
|
|
|
|
|
- _ = 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)
|
|
|
|
|
|
- _ = orm.RegisterDataBase("rddp", "mysql", utils.MYSQL_URL_RDDP)
|
|
|
+ _ = orm.RegisterDataBase("rddp", utils.DBDRIVER_NAME, 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.RegisterDataBase("edb", utils.DBDRIVER_NAME, 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.RegisterDataBase("data", utils.DBDRIVER_NAME, 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.RegisterDataBase("gl", utils.DBDRIVER_NAME, utils.MYSQL_URL_GL)
|
|
|
orm.SetMaxIdleConns("gl", 50)
|
|
|
orm.SetMaxOpenConns("gl", 100)
|
|
|
|
|
@@ -78,7 +78,7 @@ func init() {
|
|
|
|
|
|
// 用户主库
|
|
|
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.RegisterDataBase("weekly", utils.DBDRIVER_NAME, utils.MYSQL_WEEKLY_URL)
|
|
|
orm.SetMaxIdleConns("weekly", 50)
|
|
|
orm.SetMaxOpenConns("weekly", 100)
|
|
|
|
|
@@ -87,7 +87,7 @@ func init() {
|
|
|
}
|
|
|
|
|
|
if utils.MYSQL_AI_URL != "" {
|
|
|
- _ = orm.RegisterDataBase("ai", "mysql", utils.MYSQL_AI_URL)
|
|
|
+ _ = orm.RegisterDataBase("ai", utils.DBDRIVER_NAME, utils.MYSQL_AI_URL)
|
|
|
orm.SetMaxIdleConns("ai", 50)
|
|
|
orm.SetMaxOpenConns("ai", 100)
|
|
|
|
|
@@ -537,18 +537,18 @@ func initChartFramework() {
|
|
|
// initExcel 初始化EXCEL
|
|
|
func initExcel() {
|
|
|
orm.RegisterModel(
|
|
|
- new(excel.ExcelClassify), //ETA excel表格分类
|
|
|
- new(excel.ExcelInfo), //ETA excel表格
|
|
|
- new(excel.ExcelDraft), //ETA excel表格草稿
|
|
|
- new(excel.ExcelSheet), //ETA excel sheet
|
|
|
- new(excel.ExcelSheetData), //ETA excel sheet data
|
|
|
- new(excel.ExcelEdbMapping), //ETA excel 与 指标 的关系表
|
|
|
- new(excel.ExcelWorker), // 平衡表协作人表格
|
|
|
- new(excel.ExcelChartEdb), // 平衡表做图指标
|
|
|
- new(excel.ExcelChartData), // 平衡表作图数据
|
|
|
- new(excel.ExcelInfoRuleMapping), //表格的管理规则
|
|
|
+ new(excel.ExcelClassify), //ETA excel表格分类
|
|
|
+ new(excel.ExcelInfo), //ETA excel表格
|
|
|
+ new(excel.ExcelDraft), //ETA excel表格草稿
|
|
|
+ new(excel.ExcelSheet), //ETA excel sheet
|
|
|
+ new(excel.ExcelSheetData), //ETA excel sheet data
|
|
|
+ new(excel.ExcelEdbMapping), //ETA excel 与 指标 的关系表
|
|
|
+ new(excel.ExcelWorker), // 平衡表协作人表格
|
|
|
+ new(excel.ExcelChartEdb), // 平衡表做图指标
|
|
|
+ new(excel.ExcelChartData), // 平衡表作图数据
|
|
|
+ new(excel.ExcelInfoRuleMapping), //表格的管理规则
|
|
|
new(tradeAnalysisModel.TradeAnalysisTableColumn), // 持仓分析表格-自定义列
|
|
|
- new(excel.ReferencedExcelConfig), //表格的样式引用
|
|
|
+ new(excel.ReferencedExcelConfig), //表格的样式引用
|
|
|
)
|
|
|
}
|
|
|
|