package models import ( _ "github.com/go-sql-driver/mysql" "hongze/hongze_task/models/company_approval" "hongze/hongze_task/models/company_contract" "hongze/hongze_task/models/cygx" "hongze/hongze_task/models/data_manage" "hongze/hongze_task/models/data_manage/future_good" "hongze/hongze_task/models/eta_business" "hongze/hongze_task/models/roadshow" "hongze/hongze_task/models/yb" "hongze/hongze_task/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.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.RegisterDataBase("weekly_trial", "mysql", utils.MYSQL_URL_WEEKLY_TRIAL) orm.SetMaxIdleConns("weekly_trial", 50) orm.SetMaxOpenConns("weekly_trial", 100) trial_datadb, _ := orm.GetDB("weekly_trial") trial_datadb.SetConnMaxLifetime(10 * time.Minute) _ = orm.RegisterDataBase("eta", "mysql", utils.MYSQL_URL_ETA) orm.SetMaxIdleConns("eta", 50) orm.SetMaxOpenConns("eta", 100) etaDb, _ := orm.GetDB("eta") etaDb.SetConnMaxLifetime(10 * time.Minute) _ = orm.RegisterDataBase("hz_cygx", "mysql", utils.MYSQL_URL_CYGX) orm.SetMaxIdleConns("hz_cygx", 50) orm.SetMaxOpenConns("hz_cygx", 100) cygx_db, _ := orm.GetDB("hz_cygx") cygx_db.SetConnMaxLifetime(10 * time.Minute) orm.Debug = true orm.DebugLog = orm.NewLog(utils.Binlog) //注册对象 orm.RegisterModel( new(EdbinfoSendMsgRecord), new(StackCompanyStatistic), new(company_contract.CompanyContract), new(company_contract.CompanyContractPermission), new(company_approval.CompanyApproval), new(Classify), new(ReportSendThsDetail), new(Report), new(UserViewStatistics), new(roadshow.RsReportRecord), //路演记录 new(CompanyReportRecord), new(ChartPermission), // 权限表 new(ComeinWhiteUser), // 进门财经白名单 ) // 注册客户信息 数据表 initCompany() // 注册Edb指标 数据表 initEdbDataTable() // 注册研报 数据表 initYbTable() // 注册查研观向 数据表 initCygx() // 注册商品期货 相关数据表 initFutureGoodEdbDataTable() //注册持仓分析 数据表 initTradePositionTop() // ETA商家数据表 initEtaBusiness() //英文研报 initEnglishReport() // ETA商家配置表 initEtaBusinessConf() } // initCompany 注册客户信息 数据表 func initCompany() { //注册对象 orm.RegisterModel( new(Company), new(CompanyReportPermission), new(CompanyReportPermissionLog), new(CompanyOperationRecord), new(CompanyProduct), new(CompanyPermissionLog), new(CompanyEndDate), new(CompanyProductUpdateLog), //客户产品状态变更表 new(CompanyViewStatistics), new(CompanyRemindRecord), // 客户提醒记录 new(CompanyRenewalRecord), // 客户续约状态记录表 ) } // initEdbDataTable 注册Edb指标 数据表 func initEdbDataTable() { //注册对象 orm.RegisterModel( new(DataSourceLongzhong), new(Longzhonginfo), new(Longzhongdata), new(EdbdataClassify), new(Longzhongpriceinfo), new(Longzhongpricedata), new(LongzhongSurveyProduct), new(LongzhongSurveyData), new(data_manage.EdbDataWind), new(data_manage.EdbDataThs), new(data_manage.EdbDataPb), new(data_manage.BaseFromSmm), new(data_manage.BaseFromSmmIndex), new(data_manage.BaseFromSmmData), new(data_manage.EdbDataYs), new(Edbdata), new(data_manage.EdbInfoCalculateMapping), new(data_manage.EdbInfo), //hz_data库的edb_info表 new(data_manage.EdbDataCalculateZjpj), //直接拼接 new(data_manage.EdbDataCalculateLjztbpj), //累计同比值拼接 new(data_manage.EdbDataLt), //路透指标数据表 new(VarietyClassify), // 标签分类表 new(VarietyTag), // 标签表 new(ResearchVarietyTagRelation), // 研究员标签关系表 new(CompanyProductTryOutUpdateLog), //客户产品试用变更状态表 new(CompanyProductTryOutUpdatePermissionLog), //客户产品试用变更品种详情表 ) } // initYbTable 注册ETA表格 数据表 func initYbTable() { //注册对象 orm.RegisterModel( new(yb.Activity), // 研报活动表 new(yb.ActivityType), //研报活动分类表 new(yb.ActivityVoice), //研报活动语音表 new(yb.ActivityRegister), //研报活动报名表 new(yb.Speaker), //研报主持人表 new(yb.PriceDriven), // 研报价格驱动表 new(yb.ComeinEvent), //进门会议表 new(yb.ComeinEventUser), //进门会议用户表 new(yb.CommunityVideo), //研报视频社区 new(yb.VoiceBroadcast), // 语音播报 ) } // initCygx 注册查研观向 数据表 func initCygx() { //注册对象 orm.RegisterModel( new(data_manage.CygxReportMapping), new(data_manage.CygxResearchSummary), new(data_manage.CygxResearchSummaryLog), new(data_manage.CygxMinutesSummary), new(data_manage.CygxMinutesSummaryLog), new(data_manage.CygxArticle), new(data_manage.CygxArticleType), new(data_manage.CygxActivitySpecialTripBill), new(data_manage.CygxActivitySpecialInheritPointsCompany), new(cygx.CygxAllocationCompanyContract), new(cygx.CygxAllocationCompanyContractLog), new(cygx.CygxAllocationCompanyContractPermission), new(cygx.CygxAllocationCompanyContractPermissionLog), new(cygx.CygxActivitySpecialPermissionPoints), ) } // initFutureGoodEdbDataTable 注册商品期货Edb指标 数据表 func initFutureGoodEdbDataTable() { //注册对象 orm.RegisterModel( new(future_good.FutureGoodEdbInfo), ) } // initTradePositionTop 注册持仓分析 数据表 func initTradePositionTop() { //注册对象 orm.RegisterModel( new(data_manage.TradePositionDalianTop), new(data_manage.TradePositionZhengzhouTop), new(data_manage.TradePositionShanghaiTop), new(data_manage.TradePositionIneTop), new(data_manage.TradePositionCffexTop), new(data_manage.BaseFromTradeClassify), // 交易所分类 ) } // initEtaBusiness ETA商家数据表 func initEtaBusiness() { orm.RegisterModel( new(eta_business.EtaBusiness), new(eta_business.EtaBusinessContract), new(eta_business.EtaBusinessRemindRecord), ) } // initEtaBusinessConf ETA商家基本配置表 func initEtaBusinessConf() { orm.RegisterModel( new(BusinessConf), ) } // initEnglishReport 英文研报 func initEnglishReport() { orm.RegisterModel( new(EnglishReport), ) }