1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- package models
- import (
- "eta/eta_forum_hub/models/system"
- "eta/eta_forum_hub/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("weekly_trial", "mysql", utils.MYSQL_URL_WEEKLY_TRIAL)
- orm.SetMaxIdleConns("weekly_trial", 50)
- orm.SetMaxOpenConns("weekly_trial", 100)
- _ = orm.RegisterDataBase("edb_trial", "mysql", utils.MYSQL_URL_EDB_TRIAL)
- orm.SetMaxIdleConns("edb_trial", 50)
- orm.SetMaxOpenConns("edb_trial", 100)
- _ = orm.RegisterDataBase("hz_data_trial", "mysql", utils.MYSQL_URL_HZ_DATA_TRIAL)
- orm.SetMaxIdleConns("hz_data_trial", 50)
- orm.SetMaxOpenConns("hz_data_trial", 100)
- orm.Debug = true
- orm.DebugLog = orm.NewLog(utils.Binlog)
- initChart()
- initEdbData()
- initSystem()
- initEtaTrial()
- }
- // initChart 图表 数据表
- func initChart() {
- orm.RegisterModel(
- new(ChartClassify),
- new(ChartInfo),
- new(ChartEdbMapping),
- new(ChartTheme),
- new(ChartThemeType),
- new(ChartSeries),
- new(ChartSeriesEdbMapping),
- )
- }
- // initEdbData 指标服务 数据表
- func initEdbData() {
- orm.RegisterModel(
- new(EdbInfoCalculateMapping),
- new(EdbInfo),
- )
- }
- func initSystem() {
- orm.RegisterModel(
- new(system.Admin),
- new(system.SysRole),
- new(system.SysDepartment),
- new(system.SysGroup),
- )
- }
- // initEtaTrial 试用相关
- func initEtaTrial() {
- orm.RegisterModel(
- new(EtaTrial),
- new(EtaTrialActiveRecord),
- new(EtaTrialLoginDurationRecord),
- )
- }
|