|
@@ -320,16 +320,6 @@ WHERE
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-// GetReportByOldReportId 根据老后台的research_report_id查找新的报告ID
|
|
|
|
-func GetReportByOldReportId(oldReportId uint64) (item *Report, err error) {
|
|
|
|
- err = global.MYSQL["rddp"].Model(Report{}).
|
|
|
|
- Where("old_report_id=?", oldReportId).First(&item).Error
|
|
|
|
- if err == utils.ErrNoRow {
|
|
|
|
- err = nil
|
|
|
|
- }
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// GetLatestReportByPermission 根据权限相关的分类查询最新的三篇专栏报告
|
|
// GetLatestReportByPermission 根据权限相关的分类查询最新的三篇专栏报告
|
|
func GetLatestReportByPermission(classifyIdSeconds []int) (list []*pc.LatestReport, err error) {
|
|
func GetLatestReportByPermission(classifyIdSeconds []int) (list []*pc.LatestReport, err error) {
|
|
sql := `SELECT
|
|
sql := `SELECT
|
|
@@ -352,6 +342,7 @@ WHERE
|
|
AND classify_name_first != "周报"
|
|
AND classify_name_first != "周报"
|
|
AND classify_id_second in ?
|
|
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)
|
|
ORDER BY publish_time DESC LIMIT 3
|
|
ORDER BY publish_time DESC LIMIT 3
|
|
`
|
|
`
|
|
err = global.MYSQL["rddp"].Raw(sql, classifyIdSeconds).Scan(&list).Error
|
|
err = global.MYSQL["rddp"].Raw(sql, classifyIdSeconds).Scan(&list).Error
|
|
@@ -389,6 +380,16 @@ WHERE
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// GetReportByOldReportId 根据老后台的research_report_id查找新的报告ID
|
|
|
|
+func GetReportByOldReportId(oldReportId uint64) (item *Report, err error) {
|
|
|
|
+ err = global.MYSQL["rddp"].Model(Report{}).
|
|
|
|
+ Where("old_report_id=?", oldReportId).First(&item).Error
|
|
|
|
+ if err == utils.ErrNoRow {
|
|
|
|
+ err = nil
|
|
|
|
+ }
|
|
|
|
+ return
|
|
|
|
+}
|
|
|
|
+
|
|
func GetLatestReportByClassifyName(firstName string, secondId int) (items *pc.LatestReportBanner, err error) {
|
|
func GetLatestReportByClassifyName(firstName string, secondId int) (items *pc.LatestReportBanner, err error) {
|
|
sql := `SELECT
|
|
sql := `SELECT
|
|
a.id AS report_id,
|
|
a.id AS report_id,
|
|
@@ -534,7 +535,7 @@ FROM
|
|
JOIN report_chapter_permission_mapping AS b on a.report_chapter_id=b.report_chapter_id
|
|
JOIN report_chapter_permission_mapping AS b on a.report_chapter_id=b.report_chapter_id
|
|
JOIN report as ru on a.report_id=ru.id
|
|
JOIN report as ru on a.report_id=ru.id
|
|
WHERE
|
|
WHERE
|
|
- a.publish_state = 2 and ru.is_public_publish=1
|
|
|
|
|
|
+ a.publish_state = 2 and ru.is_public_publish=1 and ru.report_layout in (1,2)
|
|
AND b.chart_permission_id = ?
|
|
AND b.chart_permission_id = ?
|
|
)
|
|
)
|
|
ORDER BY publish_time DESC, report_id desc LIMIT ? OFFSET ?
|
|
ORDER BY publish_time DESC, report_id desc LIMIT ? OFFSET ?
|
|
@@ -553,7 +554,7 @@ FROM
|
|
WHERE
|
|
WHERE
|
|
has_chapter != 1
|
|
has_chapter != 1
|
|
AND classify_id_second in ?
|
|
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
|
|
UNION
|
|
|
|
|
|
@@ -565,7 +566,7 @@ FROM
|
|
JOIN report_chapter_permission_mapping AS b on a.report_chapter_id=b.report_chapter_id
|
|
JOIN report_chapter_permission_mapping AS b on a.report_chapter_id=b.report_chapter_id
|
|
JOIN report as ru on a.report_id=ru.id
|
|
JOIN report as ru on a.report_id=ru.id
|
|
WHERE
|
|
WHERE
|
|
- a.publish_state = 2 and ru.is_public_publish=1
|
|
|
|
|
|
+ a.publish_state = 2 and ru.is_public_publish=1 and ru.report_layout in (1,2)
|
|
AND b.chart_permission_id = ?
|
|
AND b.chart_permission_id = ?
|
|
)
|
|
)
|
|
)
|
|
)
|