123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- package models
- import (
- _ "github.com/go-sql-driver/mysql"
- "hongze/hongze_cygx/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("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(CygxUserFollowSpecial),
- new(CygxChart),
- new(CygxChartCollect),
- new(CygxChartTop),
- new(CygxCelueArticleHistoryRecord),
- new(CygxArticleHistoryRecordAll),
- new(CygxActivityAppointment),
- new(UserTemplateRecord),
- new(CygxUserInteractionNum),
- new(CygxChartCollectByCygx),
- )
- // 记录ORM查询日志
- orm.Debug = true
- orm.DebugLog = orm.NewLog(utils.BinLog)
- }
|