Browse Source

修改占位符

hongze 5 months ago
parent
commit
bdf8901cdd
2 changed files with 10 additions and 6 deletions
  1. 4 1
      models/report_chapter.go
  2. 6 5
      utils/common.go

+ 4 - 1
models/report_chapter.go

@@ -319,10 +319,13 @@ func GetReportChapterVideoListByReportIds(reportIds []int) (list []*ReportChapte
 			FROM
 				report_chapter
 			WHERE
-				report_id IN (` + utils.GetOrmInReplace(len(reportIds)) + `) AND publish_state = 2 AND video_url != ""
+				report_id IN (` + utils.GetOrmInReplace(len(reportIds)) + `) AND publish_state = 2 AND video_url != ''
 			ORDER BY
 				report_chapter_id ASC `
 	//_, err = o.Raw(sql, reportIds).QueryRows(&list)
+
+	//report_id IN (` + utils.GetOrmInReplace(len(reportIds)) + `) AND publish_state = 2 AND video_url != ""
+
 	err = global.DmSQL["rddp"].Raw(sql, reportIds).Find(&list).Error
 	return
 }

+ 6 - 5
utils/common.go

@@ -1382,11 +1382,12 @@ func GetReportContentTextSub(content string) (contentSub string, err error) {
 
 // GetOrmInReplace 获取orm的in查询替换?的方法
 func GetOrmInReplace(num int) string {
-	template := make([]string, num)
-	for i := 0; i < num; i++ {
-		template[i] = "?"
-	}
-	return strings.Join(template, ",")
+	//template := make([]string, num)
+	//for i := 0; i < num; i++ {
+	//	template[i] = "?"
+	//}
+	//return strings.Join(template, ",")
+	return "?"
 }
 
 // RevSlice 反转切片