package models import ( _ "github.com/go-sql-driver/mysql" "hongze/hongze_mfyx/models/order" "hongze/hongze_mfyx/utils" "time" "github.com/beego/beego/v2/client/orm" ) 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(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(CygxActivitySpecialMeetingDetail), new(CygxUserFollowSpecial), new(CygxArticleHistoryRecordAll), new(CygxActivityAppointment), new(UserTemplateRecord), new(CygxUserInteractionNum), new(CygxCompanyInteractionNum), new(CygxSessionMobile), new(CygxSearchKeyWordLog), new(CygxActivity), new(CygxIndustrialActivityGroupManagement), new(CygxIndustrialActivityGroupSubject), new(CygxActivityVoiceHistory), new(CygxThreeApiLog), new(CygxIndustrialArticleGroupManagement), new(ArticleTopHistoryRecord), new(CygxActivitySignupDetail), new(CygxMicroRoadshowVideoHistory), new(MicroRoadshowVideo), new(CygxActivityVideoHistory), new(CygxActivitySpecialTrip), new(CygxArticleComment), new(CygxResourceData), new(CygxResearchSummaryVoiceHistory), new(CygxMinutesSummaryVoiceHistory), new(CygxReportSelectionVoiceHistory), new(CygxActivitySpecialTripBill), new(CygxXzsChooseCategory), new(CygxReportSelectionSubjectHistory), new(CygxTacticsTimeLineHistory), new(CygxProductInteriorHistory), new(CygxMorningMeetingGather), new(CygxArticleCategoryMapping), new(CygxReportMappingCygx), new(CygxReportMappingGroup), 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(CygxYanxuanSpecialMessage), new(CygxYanxuanSpecialMessageLike), new(CygxYanxuanSpecialSpecialLike), new(CygxQuestionnaireVote), new(CygxQuestionnaireVoteOtherTheme), new(CygxMorningMeetingReviewChapterHistory), new(CygxAskserieVideoHistoryRecord), new(CygxAskserieVideoCollection), new(CygxAskserieVideoCollect), new(CygxVoiceAndVideoHistory), new(CygxArticleAndYanxuanRecord), new(CygxUserAdminShareHistory), new(CygxUserAdminShareCode), new(AliyunOcrLog), new(CygxActivityVivoPointRecord), ) initOrder() // 订单模块 // 记录ORM查询日志 orm.Debug = true orm.DebugLog = orm.NewLog(utils.Binlog) } // initOrder 买方研选订单模块 func initOrder() { orm.RegisterModel( new(order.CygxUserBusinessCard), //用户上传名片 new(order.CygxOrder), //订单表 new(order.CygxOrderAction), //订单操表 new(order.CygxOrderUserCard), //用户持卡表 new(order.CygxOrderUserCardLog), //用户持卡日志表 new(order.CygxOrderPayment), //支付记录表 new(order.CygxOrderVirtualAsset), //用户虚拟资产表(所购买的单篇报告,活动等) ) }