Bladeren bron

修复路演消息发送bug

317699326@qq.com 2 maanden geleden
bovenliggende
commit
80119c5838
2 gewijzigde bestanden met toevoegingen van 55 en 42 verwijderingen
  1. 54 41
      models/db.go
  2. 1 1
      models/roadshow/calendar.go

+ 54 - 41
models/db.go

@@ -32,47 +32,60 @@ func init() {
 	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("weekly_trial", "mysql", utils.MYSQL_URL_WEEKLY_TRIAL)
-	orm.SetMaxIdleConns("weekly_trial", 50)
-	orm.SetMaxOpenConns("weekly_trial", 100)
-
-	trial_datadb, _ := orm.GetDB("weekly_trial")
-	trial_datadb.SetConnMaxLifetime(10 * time.Minute)
-
-	_ = orm.RegisterDataBase("eta", "mysql", utils.MYSQL_URL_ETA)
-	orm.SetMaxIdleConns("eta", 50)
-	orm.SetMaxOpenConns("eta", 100)
-
-	etaDb, _ := orm.GetDB("eta")
-	etaDb.SetConnMaxLifetime(10 * time.Minute)
-
-	_ = orm.RegisterDataBase("hz_cygx", "mysql", utils.MYSQL_URL_CYGX)
-	orm.SetMaxIdleConns("hz_cygx", 50)
-	orm.SetMaxOpenConns("hz_cygx", 100)
-
-	cygx_db, _ := orm.GetDB("hz_cygx")
-	cygx_db.SetConnMaxLifetime(10 * time.Minute)
+	if utils.MYSQL_URL_EDB != "" {
+		_ = 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)
+
+	}
+
+	if utils.MYSQL_URL_DATA != "" {
+		_ = 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)
+	}
+
+	if utils.MYSQL_URL_GL != "" {
+		_ = 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)
+	}
+
+	if utils.MYSQL_URL_WEEKLY_TRIAL != "" {
+		_ = orm.RegisterDataBase("weekly_trial", "mysql", utils.MYSQL_URL_WEEKLY_TRIAL)
+		orm.SetMaxIdleConns("weekly_trial", 50)
+		orm.SetMaxOpenConns("weekly_trial", 100)
+
+		trial_datadb, _ := orm.GetDB("weekly_trial")
+		trial_datadb.SetConnMaxLifetime(10 * time.Minute)
+	}
+
+	if utils.MYSQL_URL_ETA != "" {
+		_ = orm.RegisterDataBase("eta", "mysql", utils.MYSQL_URL_ETA)
+		orm.SetMaxIdleConns("eta", 50)
+		orm.SetMaxOpenConns("eta", 100)
+
+		etaDb, _ := orm.GetDB("eta")
+		etaDb.SetConnMaxLifetime(10 * time.Minute)
+	}
+
+	if utils.MYSQL_URL_CYGX != "" {
+		_ = orm.RegisterDataBase("hz_cygx", "mysql", utils.MYSQL_URL_CYGX)
+		orm.SetMaxIdleConns("hz_cygx", 50)
+		orm.SetMaxOpenConns("hz_cygx", 100)
+
+		cygx_db, _ := orm.GetDB("hz_cygx")
+		cygx_db.SetConnMaxLifetime(10 * time.Minute)
+	}
 
 	orm.Debug = true
 	orm.DebugLog = orm.NewLog(utils.Binlog)

+ 1 - 1
models/roadshow/calendar.go

@@ -133,7 +133,7 @@ group by a.researcher_id,b.open_id
 `
 	o := orm.NewOrm()
 	_, err = o.Raw(sql, endTime).QueryRows(&list)
-	return nil, err
+	return
 }
 
 func ModifyRsCalendarResearcherQuestionMsgStatus(rsCalendarResearcher_id int) (err error) {