Explorar o código

文档管理-报告复制链接

gmy hai 3 meses
pai
achega
a28adce4d8
Modificáronse 3 ficheiros con 6 adicións e 16 borrados
  1. 0 7
      models/db.go
  2. 6 7
      models/outside_report.go
  3. 0 2
      utils/config.go

+ 0 - 7
models/db.go

@@ -32,13 +32,6 @@ func init() {
 		weeklyDb.SetConnMaxLifetime(10 * time.Minute)
 	}
 
-	// test_v2_hongze_rddp
-	_ = orm.RegisterDataBase("rddp", "mysql", utils.MYSQL_RDDP_URL)
-	orm.SetMaxIdleConns("rddp", 50)
-	orm.SetMaxOpenConns("rddp", 100)
-	weeklyDb, _ := orm.GetDB("rddp")
-	weeklyDb.SetConnMaxLifetime(10 * time.Minute)
-
 	orm.Debug = true
 	orm.DebugLog = orm.NewLog(utils.Binlog)
 

+ 6 - 7
models/outside_report.go

@@ -54,7 +54,7 @@ func init() {
 
 // GetOutsideReportListByConditionCount 根据条件查询列表条数
 func GetOutsideReportListByConditionCount(condition string, pars []interface{}) (count int, err error) {
-	o := orm.NewOrmUsingDB("rddp")
+	o := orm.NewOrm()
 	sql := `select count(distinct t1.outside_report_id) from outside_report t1 left join chart_permission_search_key_word_mapping t2 on t1.classify_id = t2.classify_id  where 1 = 1 `
 	sql += condition
 	err = o.Raw(sql, pars).QueryRow(&count)
@@ -67,10 +67,9 @@ func GetOutsideReportListByConditionCount(condition string, pars []interface{})
 
 // GetOutsideReportByReportCode 根据Code获取报告
 func GetOutsideReportByReportCode(reportCode string) (outsideReport *OutsideReport, err error) {
-	o := orm.NewOrmUsingDB("rddp")
-
-	outsideReport = &OutsideReport{}
-
-	err = o.QueryTable("outside_report").Filter("report_code", reportCode).One(outsideReport)
-	return
+	o := orm.NewOrm()
+	
+	sql := `SELECT * FROM outside_report WHERE report_code=?`
+	err = o.Raw(sql, reportCode).QueryRow(&outsideReport)
+	return outsideReport, err
 }

+ 0 - 2
utils/config.go

@@ -11,7 +11,6 @@ var (
 	MYSQL_URL        string //数据库连接
 	MYSQL_URL_ETA    string
 	MYSQL_WEEKLY_URL string //CRM主库
-	MYSQL_RDDP_URL   string //rddp数据库
 
 	REDIS_CACHE string //缓存地址
 	//Rc          *cache.Cache //redis缓存
@@ -132,7 +131,6 @@ func init() {
 	MYSQL_URL = config["mysql_url"]
 	MYSQL_URL_ETA = config["mysql_url_eta"]
 	MYSQL_WEEKLY_URL = config["mysql_url_weekly"]
-	MYSQL_RDDP_URL = config["mysql_rddp_url"]
 
 	REDIS_CACHE = config["beego_cache"]
 	if len(REDIS_CACHE) <= 0 {