|
@@ -0,0 +1,86 @@
|
|
|
+package models
|
|
|
+
|
|
|
+import (
|
|
|
+ _ "github.com/go-sql-driver/mysql"
|
|
|
+ "hongze/hongze_ETA_mobile_api/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("edb", "mysql", utils.MYSQL_URL_EDB)
|
|
|
+ orm.SetMaxIdleConns("edb", 50)
|
|
|
+ orm.SetMaxOpenConns("edb", 100)
|
|
|
+
|
|
|
+ edb_db, _ := orm.GetDB("edb")
|
|
|
+ edb_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.RegisterDataBase("gl", "mysql", utils.MYSQL_URL_GL)
|
|
|
+ orm.SetMaxIdleConns("gl", 50)
|
|
|
+ orm.SetMaxOpenConns("gl", 100)
|
|
|
+
|
|
|
+ gl, _ := orm.GetDB("gl")
|
|
|
+ gl.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.Debug = true
|
|
|
+ orm.DebugLog = orm.NewLog(utils.Binlog)
|
|
|
+
|
|
|
+ //注册对象
|
|
|
+ orm.RegisterModel(
|
|
|
+ new(Classify),
|
|
|
+ new(Ppt),
|
|
|
+ new(PptPages),
|
|
|
+ new(PptPublishRecord),
|
|
|
+ new(PptV2),
|
|
|
+ new(PptV2PublishRecord),
|
|
|
+ new(PptV2SaveLog),
|
|
|
+ new(PptV2Group),
|
|
|
+ new(PptV2GroupMapping),
|
|
|
+ new(PptV2Grant), //ppt授权操作表
|
|
|
+ )
|
|
|
+
|
|
|
+ // 报告相关 数据表
|
|
|
+ initReport()
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+// initReport 报告相关 数据表
|
|
|
+func initReport() {
|
|
|
+ orm.RegisterModel(
|
|
|
+ new(ClassifyMenu), // 报告分类-子目录表
|
|
|
+ )
|
|
|
+}
|
|
|
+
|
|
|
+
|