Browse Source

过滤自由布局

kobe6258 4 days ago
parent
commit
a6485a4395

+ 1 - 0
models/response/pc/report.go

@@ -80,6 +80,7 @@ FROM
 WHERE
 	classify_name_first IN  (?) 
 AND state IN (2, 6) 
+and report_layout in (1,2)
 ORDER BY
 	publish_time DESC) t GROUP BY t.classify_name_first`
 	err = global.MYSQL["rddp"].Raw(sql, classifyNames).Scan(&items).Error

+ 20 - 14
models/tables/rddp/report/query.go

@@ -262,29 +262,32 @@ WHERE
 	classify_name_first != "晨报" 
 	AND classify_name_first != "周报" 
 	AND classify_id_second in ?
-	AND state IN (2, 6) and is_public_publish=1
+	AND state IN (2, 6) and is_public_publish=1 and report_layout in (1,2)
 	)
 UNION
 	
 ( SELECT
-report_id,
-report_chapter_id,
-classify_id_first,
+a.report_id,
+a.report_chapter_id,
+a.classify_id_first,
 0 as classify_id_second,
-classify_name_first,
+a.classify_name_first,
 null as classify_name_second,
-type_id as report_chapter_type_id,
-title,
-content_sub,
-publish_time,
+a.type_id as report_chapter_type_id,
+a.title,
+a.content_sub,
+a.publish_time,
 0 as rai_report_id
 FROM
-	report_chapter
+	report_chapter  as a
+JOIN report as ru on a.report_id=ru.id
+    
 WHERE
-	publish_state = 2
-	AND type_id in ?
+	a.publish_state = 2
+	AND a.type_id in ?
+and ru.report_layout in (1,2)
 	)
-	ORDER BY publish_time DESC, report_id desc LIMIT ? OFFSET ?
+	ORDER BY a.publish_time DESC, a.report_id desc LIMIT ? OFFSET ?
 	`
 	err = global.MYSQL["rddp"].Raw(sql, classifyIdSeconds, typeIds, limit, offset).Scan(&list).Error
 	return
@@ -373,7 +376,7 @@ WHERE
 	AND c.show_type = 2
 	AND c.is_show = 1
     AND c.enabled = 1
-	AND state IN (2, 6) and is_public_publish=1
+	AND state IN (2, 6) and is_public_publish=1 and report_layout in (1,2)
 	ORDER BY publish_time DESC LIMIT 1
 	`
 	err = global.MYSQL["rddp"].Raw(sql).First(&list).Error
@@ -406,6 +409,7 @@ FROM
 	JOIN classify as b
 WHERE
 	a.state IN (2, 6)  and a.is_public_publish=1
+and a.report_layout in (1,2)
 	AND a.classify_name_first = "%v" 
 	AND a.classify_id_second = %v 
 	AND a.classify_id_second = b.id
@@ -427,6 +431,7 @@ WHERE
 	AND classify_name_first != "周报" 
 	AND classify_id_second in ?
 	AND state IN (2, 6) and is_public_publish=1
+	AND report_layout in (1,2)
 	ORDER BY publish_time DESC, id desc LIMIT ? OFFSET ?
 	`
 	err = global.MYSQL["rddp"].Raw(sql, classifyIdSeconds, limit, offset).Scan(&list).Error
@@ -599,6 +604,7 @@ FROM
 	report as a
 WHERE
 	a.state IN (2, 6) and a.is_public_publish=1
+  and a.report_layout in (1,2)
 	AND a.classify_id_first = ? 
 	AND a.classify_id_second = ? 
 	AND a.classify_id_third = ? 

+ 19 - 14
models/tables/rddp/report_chapter/query.go

@@ -8,16 +8,18 @@ import (
 
 func GetLatestChaptersByTypeIdsAndClass(typeIds []int, classifyNameFirst string) (list []*ReportChapter, err error) {
 	sql := `SELECT
-	DISTINCT report_id
+	DISTINCT a.report_id
 FROM
-	report_chapter
+	report_chapter as a 
+	JOIN report as ru on a.report_id=ru.id
 WHERE
-	type_id IN (?) 
-	AND publish_state = 2 
-	AND is_edit = 1
-	AND report_type = ?
+	a.type_id IN (?) 
+	AND a.publish_state = 2 
+	AND a.is_edit = 1
+	AND a.report_type = ?
+    and ru.report_layout in (1,2)
 ORDER BY
-	publish_time desc, report_chapter_id desc limit 30
+	a.publish_time desc, a.report_chapter_id desc limit 30
 `
 	err = global.MYSQL["rddp"].Model(ReportChapter{}).Raw(sql, typeIds, classifyNameFirst).Scan(&list).Error
 	return
@@ -204,15 +206,17 @@ func GetListByChapterIds(chapterIds []int) (list []*ReportChapter, err error) {
 // @return err error
 func GetLatestChapterByMinClassifyId(minClassifyId int) (items *ReportChapter, err error) {
 	sql := `SELECT
-	report_id,
-	classify_name_first,
-	classify_id_first,
-	stage 
+	a.report_id,
+	a.classify_name_first,
+	a.classify_id_first,
+	a.stage 
 FROM
-	report_chapter 
+	report_chapter as a 
+JOIN report as ru on a.report_id=ru.id
 WHERE
-	publish_state = 2 
-	AND classify_id_first = ?
+	a.publish_state = 2 
+	AND a.classify_id_first = ?
+and ru.report_layout in (1,2)
 ORDER BY
 	publish_time DESC `
 	err = global.MYSQL["rddp"].Raw(sql, minClassifyId).First(&items).Error
@@ -247,6 +251,7 @@ WHERE
 	AND a.classify_id_first = ?
 	AND a.report_id=b.id
 	AND b.state IN (2, 6)
+AND b.report_layout in (1,2)
 ORDER BY
 	publish_time DESC) t
 	GROUP BY report_id