123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- package models
- import (
- _ "github.com/go-sql-driver/mysql"
- "hongze/hongze_ETA_mobile_api/models/data_manage"
- "hongze/hongze_ETA_mobile_api/models/ppt_english"
- "hongze/hongze_ETA_mobile_api/models/system"
- "hongze/hongze_ETA_mobile_api/utils"
- "time"
- "github.com/beego/beego/v2/client/orm"
- )
- 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.Debug = true
- orm.DebugLog = orm.NewLog(utils.Binlog)
- //注册对象
- orm.RegisterModel(
- new(Classify),
- new(Ppt),
- new(PptPages),
- new(PptPublishRecord),
- new(PptV2),
- new(PptV2PublishRecord),
- new(PptV2SaveLog),
- new(PptV2Group),
- new(PptV2GroupMapping),
- new(PptV2Grant), //ppt授权操作表
- )
- // 报告相关 数据表
- initReport()
- initSystem()
- initChart()
- initEdbData()
- // 英文ppt
- initPptEnglish()
- //多图配置
- initMultipleGraphConfig()
- // 英文报告
- initEnglishReport()
- }
- // initSystem 系统表 数据表
- func initSystem() {
- orm.RegisterModel(
- new(system.SysUserLoginRecord),
- new(system.SysSession),
- new(system.Admin),
- new(system.AdminConfig), //系统用户配置表
- )
- }
- // initReport 报告相关 数据表
- func initReport() {
- orm.RegisterModel(
- new(Report),
- new(ResearchReport), //日报、周报信息
- new(ChartPermissionSearchKeyWordMapping), //报告分类权限表
- new(ReportChapter), // 报告章节表
- new(ReportChapterTicker), // 晨报章节ticker
- new(ReportChapterTypePermission), // 晨周报章节类型权限表
- new(YbPcSuncode),
- new(YbSuncodePars),
- new(ReportAuthor), //报告作者
- new(ClassifyMenu), // 报告分类-子目录表
- new(ClassifyMenuRelation), // 报告分类-子目录关联表
- new(ChartPermissionChapterMapping), // 权限mapping表
- new(ReportChapterType), // 报告章节类型表
- )
- }
- // initChart 图表 数据表
- func initChart() {
- orm.RegisterModel(
- new(data_manage.ChartClassify),
- new(data_manage.ChartInfo),
- new(data_manage.ChartEdbMapping),
- new(data_manage.MyChartClassify),
- new(data_manage.MyChart),
- new(data_manage.MyChartLog),
- new(data_manage.MyChartClassifyMapping),
- new(data_manage.ChartInfoLog),
- new(data_manage.ChartInfoCorrelation),
- )
- }
- // initEdbData 指标服务 数据表
- func initEdbData() {
- orm.RegisterModel(
- new(data_manage.SearchKeyword),
- )
- }
- // initPptEnglish ppt英文
- func initPptEnglish() {
- orm.RegisterModel(
- new(ppt_english.PptEnglish),
- new(ppt_english.PptEnglishPublishRecord),
- new(ppt_english.PptEnglishSaveLog),
- new(ppt_english.PptEnglishGroup),
- new(ppt_english.PptEnglishGroupMapping),
- new(ppt_english.PptEnglishGrant), //ppt授权操作表
- new(ppt_english.ReportPptEnglishImg), //Ppt转报告的图片记录表
- )
- }
- // initMultipleGraphConfig 多图配置 数据表
- func initMultipleGraphConfig() {
- //注册对象
- orm.RegisterModel(
- new(data_manage.MultipleGraphConfig), //多图配置表
- new(data_manage.MultipleGraphConfigChartMapping), //图表与多图配置的关系表
- //new(data_manage.MultipleGraphConfigEdbMapping), //指标与多图配置的关系表
- )
- }
- // initEnglishReport 英文报告
- func initEnglishReport() {
- orm.RegisterModel(
- new(EnglishReport),
- new(EnglishPolicyReport),
- new(EnglishReportEmail),
- new(EnglishReportEmailLog),
- new(EnglishClassify),
- new(EnglishVideo), // 英文研报线上路演
- )
- }
|