package models import ( "eta/eta_forum_admin/models/company" "eta/eta_forum_admin/models/eta_business" "eta/eta_forum_admin/models/eta_training_video" "eta/eta_forum_admin/models/eta_trial" "eta/eta_forum_admin/models/help_doc" "eta/eta_forum_admin/models/system" "eta/eta_forum_admin/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.Debug = true orm.DebugLog = orm.NewLog(utils.Binlog) initChart() initEdbData() initUser() initETATrial() initEtaBusiness() initSystem() // ETA版本更新日志 initEtaVersionUpdateLog() // 帮助文档 initHelpDoc() // ETA培训视频相关表 initEtaTrainingVideo() } // initChart 图表 数据表 func initChart() { orm.RegisterModel( new(ChartClassify), new(ChartInfo), new(ChartEdbMapping), new(ChartTheme), new(ChartThemeType), new(ChartInfoLog), new(SearchKeyword), ) } // initEdbData 指标服务 数据表 func initEdbData() { orm.RegisterModel( new(EdbInfoCalculateMapping), new(EdbInfo), ) } // 初始化用户服务 func initUser() { orm.RegisterModel( new(system.SysSession), new(system.SysUserLoginRecord), new(system.Admin), new(system.AdminOperateRecord), ) } // initETATrial ETA试用 func initETATrial() { orm.RegisterModel( new(eta_trial.EtaTrial), new(eta_trial.EtaTrialApproval), //new(eta_trial.EtaTrialQuestionnaire), new(company.CompanyApprovalMessage), ) } // initEtaBusiness ETA商家相关表 func initEtaBusiness() { orm.RegisterModel( new(eta_business.EtaBusiness), // ETA商家表 new(eta_business.EtaBusinessContract), // ETA合同表 new(eta_business.EtaBusinessOperationRecord), // ETA操作记录表 new(eta_business.EtaBusinessMenu), // ETA商家菜单表 new(eta_business.EtaBusinessMenuRelate), // ETA商家菜单关联表 new(eta_business.EtaBusinessConfigRelate), // ETA商家配置关联表 new(eta_business.EtaBusinessMenuIcon), // ETA商家菜单icon表 new(User), // 商家用户表 new(eta_business.BusinessChartClassifyPermission), //商家图表权限表 ) } // initSystem 系统表 数据表 func initSystem() { orm.RegisterModel( new(system.SysRole), new(system.SysMenuButton), new(system.SysRoleAdmin), //管理员账号和角色映射表 new(system.SysRoleMenu), ) } // initEtaVersionUpdateLog ETA版本更新日志 func initEtaVersionUpdateLog() { orm.RegisterModel( new(EtaVersionUpdateLog), // 更新日志表 ) } func initHelpDoc() { //注册对象 orm.RegisterModel( new(help_doc.HelpDocClassify), //分类 new(help_doc.HelpDoc), //文章 ) } // initEtaTrainingVideo ETA培训视频相关表 func initEtaTrainingVideo() { orm.RegisterModel( new(eta_training_video.EtaTrainingVideo), // 视频表 new(eta_training_video.EtaTrainingVideoOpLog), // 视频操作记录表 //new(eta_training_video.EtaTrainingVideoViewLog), // 视频访问记录表 new(eta_training_video.EtaTrainingVideoTag), // 标签表 new(eta_training_video.EtaTrainingVideoTagRelate), // 标签关联表 new(eta_training_video.EtaTrainingVideoClassify), // 分类表 new(eta_training_video.EtaTrainingVideoClassifyRelate), // 分类关联表 ) }