|
@@ -7,6 +7,7 @@ import (
|
|
|
"hongze/hongze_yb/models/tables/customer_comment"
|
|
|
"hongze/hongze_yb/models/tables/rddp/classify"
|
|
|
"hongze/hongze_yb/models/tables/rddp/report"
|
|
|
+ "hongze/hongze_yb/models/tables/rddp/report_chapter"
|
|
|
"hongze/hongze_yb/models/tables/yb_activity"
|
|
|
"hongze/hongze_yb/models/tables/yb_pc_suncode"
|
|
|
"hongze/hongze_yb/services"
|
|
@@ -159,6 +160,7 @@ func ClassifyDetailBanner(c *gin.Context) {
|
|
|
// Recommend 专栏详情页更多推荐
|
|
|
func Recommend(c *gin.Context) {
|
|
|
reqReportId := c.DefaultQuery("reportId", "")
|
|
|
+ classifyName := c.DefaultQuery("classify_name_first", "")
|
|
|
if reqReportId == "" {
|
|
|
response.Fail("请输入二级分类标识", c)
|
|
|
return
|
|
@@ -168,34 +170,66 @@ func Recommend(c *gin.Context) {
|
|
|
response.Fail("报告ID格式有误", c)
|
|
|
return
|
|
|
}
|
|
|
- reportInfo, err := report.GetByReportId(reportId)
|
|
|
- if err != nil {
|
|
|
- response.Fail("报告查询出错", c)
|
|
|
- return
|
|
|
- }
|
|
|
- if reportInfo.Id == 0 {
|
|
|
- response.Fail("报告不存在", c)
|
|
|
- return
|
|
|
- }
|
|
|
|
|
|
- if reportInfo.State != 2 {
|
|
|
- response.Fail("报告未发布", c)
|
|
|
- return
|
|
|
- }
|
|
|
+ var recommendResp []*pcModels.RecommendResp
|
|
|
+ if classifyName == "周报" || classifyName == "晨报" {
|
|
|
+ recommendList, err := report_chapter.GetWeekRecommendList(reportId, classifyName)
|
|
|
+ if err != nil {
|
|
|
+ response.Fail("获取报告详情失败"+err.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, chapter := range recommendList {
|
|
|
+ resp := &pcModels.RecommendResp{
|
|
|
+ ReportId: chapter.ReportId,
|
|
|
+ ReportChapterID: chapter.ReportChapterId,
|
|
|
+ Title: chapter.Title,
|
|
|
+ Stage: chapter.Stage,
|
|
|
+ ClassifyNameFirst: chapter.ClassifyNameFirst,
|
|
|
+ ClassifySecondFirst: "",
|
|
|
+ }
|
|
|
+ recommendResp = append(recommendResp, resp)
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ reportInfo, err := report.GetByReportId(reportId)
|
|
|
+ if err != nil {
|
|
|
+ response.Fail("报告查询出错", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if reportInfo.Id == 0 {
|
|
|
+ response.Fail("报告不存在", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
- reportType := 0
|
|
|
- if reportInfo.ClassifyNameFirst == "权益研报" {
|
|
|
- reportType = 1
|
|
|
- } else {
|
|
|
- reportType = 2
|
|
|
- }
|
|
|
- recommendList, err := pcModels.GetRecommendList(reportId, reportType, reportInfo.ClassifyIdSecond)
|
|
|
- if err != nil {
|
|
|
- response.Fail("获取报告详情失败"+err.Error(), c)
|
|
|
- return
|
|
|
- }
|
|
|
+ if reportInfo.State != 2 {
|
|
|
+ response.Fail("报告未发布", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
- response.OkData("查询成功", recommendList, c)
|
|
|
+ reportType := 0
|
|
|
+ if reportInfo.ClassifyNameFirst == "权益研报" {
|
|
|
+ reportType = 1
|
|
|
+ } else {
|
|
|
+ reportType = 2
|
|
|
+ }
|
|
|
+
|
|
|
+ recommendList, err := pcModels.GetRecommendList(reportId, reportType, reportInfo.ClassifyIdSecond)
|
|
|
+ if err != nil {
|
|
|
+ response.Fail("获取报告详情失败"+err.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, chapter := range recommendList {
|
|
|
+ resp := &pcModels.RecommendResp{
|
|
|
+ ReportId: chapter.Id,
|
|
|
+ ReportChapterID: 0,
|
|
|
+ Title: chapter.Title,
|
|
|
+ Stage: chapter.Stage,
|
|
|
+ ClassifyNameFirst: chapter.ClassifyNameFirst,
|
|
|
+ ClassifySecondFirst: chapter.ClassifyNameSecond,
|
|
|
+ }
|
|
|
+ recommendResp = append(recommendResp, resp)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ response.OkData("查询成功", recommendResp, c)
|
|
|
return
|
|
|
}
|
|
|
|