package models import ( "eta/eta_crawler/utils" "time" _ "github.com/go-sql-driver/mysql" "github.com/beego/beego/v2/client/orm" ) func init() { if utils.BusinessCode == utils.BusinessCodeRelease { _ = 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("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.Debug = true orm.DebugLog = orm.NewLog(utils.Binlog) //注册对象 orm.RegisterModel( new(BaseFromTradeZhengzhouIndex), new(BaseFromTradeShanghaiIndex), new(BaseFromTradeIneIndex), new(BaseFromTradeCffexIndex), new(BaseFromTradeEicIndex), new(BaseFromTradeEicIndexV2), new(BaseFromTradeMapping), new(BaseFromChangesVisitorsCovid), new(BaseFromTradeDalianIndex), new(BaseFromCoalmineMapping), new(BaseFromCoalmineJsmIndex), new(BaseFromCoalmineCompanyIndex), new(BaseFromCoalmineFirmIndex), new(BaseFromCoalmineCoastalIndex), new(BaseFromCoalmineInlandIndex), //new(BaseFromTradeDalianData), new(BaseFromEiaSteoIndex), new(BaseFromEiaSteoData), new(BaseFromEiaSteoClassify), new(ComTradeCountry), new(ComTradeData), new(ComTradeCodeMapping), new(BaseFromNationalStatisticsClassify), new(BaseFromNationalStatisticsIndex), new(BaseFromNationalStatisticsData), new(MeetingProbabilities), new(BaseFromIcpiIndex), new(BaseFromIcpiData), ////广期 new(BaseFromTradeGuangzhouClassify), new(BaseFromTradeGuangzhouIndex), new(BaseFromTradeGuangzhouData), new(BaseFromTradeGuangzhouContract), new(BaseFromIcpiClassify), new(BaseFromSci99Index), new(BaseFromSci99Data), new(BaseFromSci99Classify), ) }