xyxie 3 天之前
父节点
当前提交
19411550e8
共有 1 个文件被更改,包括 14 次插入2 次删除
  1. 14 2
      models/forum_chart_edb_mapping.go

+ 14 - 2
models/forum_chart_edb_mapping.go

@@ -1,6 +1,7 @@
 package models
 
 import (
+	"eta/eta_forum_task/utils"
 	"time"
 
 	"github.com/beego/beego/v2/client/orm"
@@ -17,8 +18,19 @@ type ForumChartEdbMapping struct {
 // 根据chartInfoId获取edbInfoIds
 func GetEdbInfoIdsByChartInfoId(chartInfoId int) (edbInfoIds string, err error) {
 	o := orm.NewOrmUsingDB("data")
-	sql := `SELECT edb_info_ids FROM forum_chart_edb_mapping WHERE chart_info_id = ?`
-	err = o.Raw(sql, chartInfoId).QueryRow(&edbInfoIds)
+	item := new(ForumChartEdbMapping)
+	sql := `SELECT * FROM forum_chart_edb_mapping WHERE chart_info_id = ?`
+	err = o.Raw(sql, chartInfoId).QueryRow(&item)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		return
+	}else{
+		if err == nil {
+			edbInfoIds = item.EdbInfoIds
+			return
+		}
+		err = nil
+	}
+	
 	return
 }