package models import ( "github.com/beego/beego/v2/client/orm" _ "github.com/go-sql-driver/mysql" "hongze/hongze_cygx/models/ficc_report" "hongze/hongze_cygx/models/order" "hongze/hongze_cygx/models/rai_serve" "hongze/hongze_cygx/models/time_line" "hongze/hongze_cygx/models/yidong" "hongze/hongze_cygx/utils" "time" ) func init() { _ = orm.RegisterDataBase("default", "mysql", utils.MYSQL_URL_CYGX) orm.SetMaxIdleConns("default", 50) orm.SetMaxOpenConns("default", 100) cygx_db, _ := orm.GetDB("default") cygx_db.SetConnMaxLifetime(10 * time.Minute) _ = orm.RegisterDataBase("weekly_report", "mysql", utils.MYSQL_URL) orm.SetMaxIdleConns("weekly_report", 50) orm.SetMaxOpenConns("weekly_report", 100) db, _ := orm.GetDB("weekly_report") 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("tactics", "mysql", utils.MYSQL_URL_TACTICS) orm.SetMaxIdleConns("tactics", 50) orm.SetMaxOpenConns("tactics", 100) tacticsDb, _ := orm.GetDB("tactics") tacticsDb.SetConnMaxLifetime(10 * time.Minute) orm.RegisterDataBase("comein_data", "mysql", utils.MYSQL_URL_COMEIN_DATA) orm.SetMaxIdleConns("comein_data", 50) orm.SetMaxOpenConns("comein_data", 100) comein_datadb, _ := orm.GetDB("comein_data") comein_datadb.SetConnMaxLifetime(10 * time.Minute) // //orm.RegisterDataBase("comein_data", "mysql", utils.MYSQL_URL_COMEIN_DATA) //orm.SetMaxIdleConns("comein_data", 50) //orm.SetMaxOpenConns("comein_data", 100) // //comein_dataDb, _ := orm.GetDB("comein_data") //comein_dataDb.SetConnMaxLifetime(10 * time.Minute) //注册对象 orm.RegisterModel( new(WxUser), new(CygxSession), new(WxUserLog), new(WxUserCode), new(CygxArticleCollect), new(CygxArticleViewRecord), new(CygxAdvice), new(MsgCode), new(Resource), new(CygxApplyRecord), new(CygxInterviewApply), new(CygxArticle), new(CygxArticleHistoryRecord), new(CygxSearchKeyWord), new(UserRecord), new(CygxIndustryTop), new(CygxActivitySignup), new(CygxActivitySignupLog), new(CygxActivityUserSearchContent), new(CygxActivityMeetingReminder), new(CygxActivityMeetingReminderLog), new(CygxMySchedule), new(WxUserWhite), new(CygxActivityHelpAsk), new(CygxIndustryFllow), new(CygxArticleDepartmentFollow), new(CygxArticleAsk), new(CygxPageHistoryRecord), new(CygxReportHistoryRecord), new(CygxArticleAuthor), new(CygxUserRecord), new(CygxReportIndustrialSeaarchHistory), new(CygxArticleHistoryRecordNewpv), new(CygxActivitySearchHistory), new(CygxActivityAttendanceDetail), new(CygxActivityRestrictSignup), new(CygxActivityMeetDetailLog), new(CygxUserSearchKeyWord), new(CompanyReportPermission), new(Company), new(CompanyLog), new(CompanyOperationRecord), new(CompanyPermissionLog), new(CompanyProduct), new(CompanyProductLog), new(UserSellerRelation), new(CygxShanghaiCompanyLog), new(CygxShanghaiErrLog), new(CygxUserFreeeButton), new(UserInvitee), new(CygxActivitySpecialSignup), new(CygxActivitySpecialMeetingDetail), new(CygxUserFollowSpecial), new(CygxChart), new(CygxChartCollect), new(CygxChartTop), new(CygxCelueArticleHistoryRecord), new(CygxArticleHistoryRecordAll), new(CygxActivityAppointment), new(UserTemplateRecord), new(CygxUserInteractionNum), new(CygxChartCollectByCygx), new(CygxCompanyInteractionNum), new(CygxChartAll), new(CygxSessionMobile), new(CygxSearchKeyWordLog), new(CygxActivity), new(CygxYidongActivityMeetingApiLog), new(CygxIndustrialActivityGroupManagement), new(CygxIndustrialActivityGroupSubject), new(CygxActivityVoiceHistory), new(CygxThreeApiLog), new(CygxIndustrialArticleGroupManagement), new(ArticleTopHistoryRecord), new(CygxActivitySignupDetail), new(CygxMicroRoadshowVideoHistory), new(MicroRoadshowVideo), new(CygxActivityVideoHistory), new(CygxActivitySpecialTrip), new(CygxArticleData), new(CygxArticleComment), new(CygxResourceData), new(CygxResearchSummaryVoiceHistory), new(CygxMinutesSummaryVoiceHistory), new(CygxReportSelectionVoiceHistory), new(CygxActivitySpecialTripBill), new(CygxXzsChooseCategory), new(CygxXzsChooseCategoryZhouqi), //周期的关注系列 new(CygxReportSelectionSubjectHistory), new(CygxTacticsTimeLineHistory), new(CygxProductInteriorHistory), new(CygxMorningMeetingGather), new(CygxArticleCategoryMapping), new(CygxReportMappingCygx), new(CygxReportMappingGroup), new(CygxAboutUsVideoHistory), new(CygxActivitySignin), new(CygxActivitySigninLog), new(CygxActivityOfflineMeetingDetail), new(CygxBannerHistory), new(CygxActivitySignupBreak), new(CygxReportHistoryRecordLog), new(CygxUserLabel), new(CygxUserLabelActivity), new(CygxUserLabelArticle), new(CygxUserLabelActivitySpecial), new(CygxInviteCompany), new(CygxActivityPointsBill), new(CygxActivityPointsCompany), new(CygxTagHistory), new(CygxReportMappingCategoryGroup), new(CygxActivitySpecialInheritPointsCompany), new(CygxApplyCollection), new(CygxArticleApplyAppointmentExpert), new(CygxBannerYxSurvey), new(CygxReportSelectionLogApply), new(CygxResourceDataIndustrialGroupManagement), new(CygxResourceDataIndustrialGroupSubject), new(CygxIndustryFllowLog), new(CygxYanxuanSpecialRecord), new(CygxYanxuanSpecialRecordLog), new(CygxYanxuanSpecialCollect), new(CygxYanxuanSpecial), new(CygxYanxuanSpecialFollow), new(CygxYanxuanSpecialCompany), new(CygxYanxuanSpecialApprovalLog), new(CygxQuestionnaireVote), new(CygxQuestionnaireVoteOtherTheme), new(CygxMorningMeetingReviewChapterHistory), new(CygxAskserieVideoHistoryRecord), new(CygxAskserieVideoCollection), new(CygxAskserieVideoCollect), new(CygxVoiceAndVideoHistory), new(CygxArticleAndYanxuanRecord), new(CygxTimelineLog), new(CygxActivitySpecialPermissionPoints), new(time_line.CygxGushouTimeLineHistory), new(CygxXzsChooseSend), ) initOrder() // 订单模块 initRaiServe() // 权益服务记录模块 initFiccReport() // 权益服务记录模块 initYidong() // 易董初始化数据模块 // 记录ORM查询日志 orm.Debug = true orm.DebugLog = orm.NewLog(utils.Binlog) } // initOrder 买方研选订单模块 func initOrder() { orm.RegisterModel( new(order.CygxOrder), //订单表 new(order.CygxOrderAction), //订单操表 new(order.CygxOrderUserCard), //用户持卡表 new(order.CygxOrderUserCardLog), //用户持卡日志表 new(order.CygxOrderPayment), //支付记录表 new(order.CygxOrderVirtualAsset), //用户虚拟资产表(所购买的单篇报告,活动等) ) } // 权益服务记录模块 func initRaiServe() { orm.RegisterModel( new(rai_serve.CygxRaiServeBill), //服务明细表 new(rai_serve.CygxRaiServeCompany), //当前所属权益服务公司表 new(rai_serve.CygxRaiServeWeekBill), //当前所属权益服务公司周度统计表 new(rai_serve.CygxRaiCompanyUserBill), //权益正式,试用客户近四周互动记录统计表 ) } // ficc研报 func initFiccReport() { orm.RegisterModel( new(ficc_report.FiccYbXcxHistory), //ficc研报小程序点击记录 ) } // initYidong func initYidong() { orm.RegisterModel( new(yidong.CygxYidongActivity), //易董活动原始数据 new(yidong.CygxYidongActivityMeetData), //易董活动到会信息原始数据 ) }