123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- package models
- import (
- "eta/eta_index_lib/models/future_good"
- "eta/eta_index_lib/models/supply_analysis"
- "eta/eta_index_lib/utils"
- "github.com/beego/beego/v2/client/orm"
- _ "github.com/go-sql-driver/mysql"
- "time"
- )
- 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("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("gl", "mysql", utils.MYSQL_URL_GL)
- orm.SetMaxIdleConns("gl", 50)
- orm.SetMaxOpenConns("gl", 100)
- gl, _ := orm.GetDB("gl")
- gl.SetConnMaxLifetime(10 * time.Minute)
- orm.Debug = true
- orm.DebugLog = orm.NewLog(utils.Binlog)
- //注册对象
- orm.RegisterModel(
- new(EdbDataCalculateZjpj),
- new(EdbDataCalculateLjztbpj),
- new(EdbInfo),
- new(EdbInfoCalculateMapping),
- new(EdbPythonCode),
- new(EdbDataPython),
- new(ChartEdbMapping),
- new(PredictEdbConf),
- new(EdbClassify),
- new(PredictEdbConfCalculateMapping),
- new(PredictEdbRuleData),
- new(EdbDataCalculateNhcc),
- new(EdbDataPredictCalculateLjztbpj),
- new(EdbDataPredictCalculateNhcc),
- new(EdbDataPredictCalculateZjpj),
- new(EdbDataInsertConfig),
- new(EdbAdjustConf), // 数据调整的配置
- new(BaseFromMysteelChemicalClassify),
- )
- // 注册期货数据 数据表
- initFutureGood()
- // 供应分析 数据表
- initSupplyAnalysis()
- // 基础指标表
- initBaseIndex()
- }
- // initFutureGood 注册期货数据 数据表
- func initFutureGood() {
- //注册对象
- orm.RegisterModel(
- new(future_good.FutureGoodEdbInfo), //期货指标表
- new(future_good.FutureGoodEdbData), //期货指标数据表
- new(future_good.ChartInfoFutureGoodProfit), //商品期货利润图表相关的信息
- )
- }
- // initSupplyAnalysis 供应分析
- func initSupplyAnalysis() {
- orm.RegisterModel(
- new(supply_analysis.Variety),
- new(supply_analysis.VarietyAdminPermission),
- new(supply_analysis.VarietyEdbInfo),
- new(supply_analysis.VarietyPlant),
- new(supply_analysis.BaseFromStockPlantData),
- )
- }
- // initBaseIndex 基础指标表
- func initBaseIndex() {
- orm.RegisterModel(
- new(BaseFromSciIndex),
- new(BaseFromSciData),
- new(BaseFromBaiinfoIndex),
- new(BaseFromBaiinfoData),
- new(BaseFromSmmIndex),
- new(BaseFromSmmData),
- new(BaseFromMysteelChemicalIndex),
- new(BaseFromMysteelChemicalData),
- )
- }
|