package models import ( "eta/eta_mini_crm_ht/utils" "time" "github.com/beego/beego/v2/client/orm" _ "github.com/go-sql-driver/mysql" ) func init() { _ = orm.RegisterDataBase("rddp", "mysql", utils.MYSQL_URL_RDDP) orm.SetMaxIdleConns("rddp", 50) orm.SetMaxOpenConns("rddp", 100) report_db, err := orm.GetDB("rddp") if err != nil { utils.FileLog.Error("连接研报数据库失败" + err.Error()) } report_db.SetConnMaxLifetime(10 * time.Minute) _ = orm.RegisterDataBase("default", "mysql", utils.MYSQL_URL_MASTER) orm.SetMaxIdleConns("default", 50) orm.SetMaxOpenConns("default", 100) db, _ := orm.GetDB("default") db.SetConnMaxLifetime(10 * time.Minute) orm.Debug = true orm.DebugLog = orm.NewLog(utils.BinLog) orm.RegisterModel( new(SysSession), new(SysRole), new(SysUser), new(SysDepartment), new(SysMenu), new(SysRoleMenuMapping), new(ChartPermission), new(UserChartPermissionMapping), new(User), new(CrmConfig), new(ReportPdf), new(TemplateUser), new(CrmFinancialAnalyst), new(Media), new(MetaInfo), new(FeedBack), new(MediaPermissionMapping), new(ImageSource), new(Report), new(RiskConfig), new(Permission), new(CustomerProductRiskMapping), new(UserSourceClickFlow), new(MerchantProduct), new(ProductOrder), new(TradeOrder), new(RefundDealFlow), ) }