|
@@ -19,6 +19,7 @@ import (
|
|
|
"hongze/hongze_yb/models/tables/yb_pc_suncode"
|
|
|
"hongze/hongze_yb/services"
|
|
|
"hongze/hongze_yb/services/pc"
|
|
|
+ report2 "hongze/hongze_yb/services/report"
|
|
|
userService "hongze/hongze_yb/services/user"
|
|
|
"hongze/hongze_yb/services/wechat"
|
|
|
"hongze/hongze_yb/utils"
|
|
@@ -151,28 +152,39 @@ func ClassifyDetail(c *gin.Context) {
|
|
|
// ClassifyDetailBanner 专栏详情banner图
|
|
|
func ClassifyDetailBanner(c *gin.Context) {
|
|
|
reqReportId := c.DefaultQuery("reportId", "")
|
|
|
- classifyName := c.DefaultQuery("classify_name_first", "")
|
|
|
- if reqReportId == "" {
|
|
|
- response.Fail("请输入二级分类标识", c)
|
|
|
- return
|
|
|
- }
|
|
|
+ //classifyName := c.DefaultQuery("classify_name_first", "")
|
|
|
+ //if reqReportId == "" {
|
|
|
+ // response.Fail("请输入二级分类标识", c)
|
|
|
+ // return
|
|
|
+ //}
|
|
|
reportId, err := strconv.Atoi(reqReportId)
|
|
|
if err != nil {
|
|
|
response.Fail("报告ID格式有误", c)
|
|
|
return
|
|
|
}
|
|
|
+ reportInfo, err := report.GetByReportId(reportId)
|
|
|
+ if err != nil {
|
|
|
+ response.Fail("报告查询出错", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
//查询分类类别,根据分类配置显示专栏还是报告合集
|
|
|
- parentClassify, err := classify.GetByClassifyNameFirst(classifyName)
|
|
|
+ parentClassify, err := classify.GetByClassifyIdFirst(reportInfo.ClassifyIdFirst)
|
|
|
if err != nil {
|
|
|
response.Fail("获取分类信息失败"+err.Error(), c)
|
|
|
return
|
|
|
}
|
|
|
+ minClassifyId, _, err := report2.GetMinClassify(reportInfo)
|
|
|
+ if err != nil {
|
|
|
+ response.FailMsg("查询最新一期报告合集失败", "查询最新一期报告合集失败1:"+err.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
var bannerResp *pcModels.DetailBannerResp
|
|
|
- if classifyName == "周报" || classifyName == "晨报" {
|
|
|
- chapterItem, err := report_chapter.GetLatestChapterByClassifyName(classifyName)
|
|
|
+ if reportInfo.HasChapter == 1 {
|
|
|
+ chapterItem, err := report_chapter.GetLatestChapterByMinClassifyId(minClassifyId)
|
|
|
if err != nil {
|
|
|
- response.Fail("查询最新一期晨周报失败"+err.Error(), c)
|
|
|
+ response.FailMsg("查询最新一期报告合集失败2", "查询最新一期报告合集失败2:"+err.Error(), c)
|
|
|
return
|
|
|
}
|
|
|
resp := &pcModels.DetailBannerResp{
|
|
@@ -186,11 +198,6 @@ func ClassifyDetailBanner(c *gin.Context) {
|
|
|
}
|
|
|
bannerResp = resp
|
|
|
} else {
|
|
|
- reportInfo, err := report.GetByReportId(reportId)
|
|
|
- if err != nil {
|
|
|
- response.Fail("报告查询出错", c)
|
|
|
- return
|
|
|
- }
|
|
|
if reportInfo.Id == 0 {
|
|
|
response.Fail("报告不存在", c)
|
|
|
return
|
|
@@ -201,23 +208,30 @@ func ClassifyDetailBanner(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- reportItem, err := report.GetLatestReportByClassifyName(classifyName, reportInfo.ClassifyIdSecond)
|
|
|
+ reportItem, err := report.GetLatestReportByClassifyId(reportInfo.ClassifyIdFirst, reportInfo.ClassifyIdSecond, reportInfo.ClassifyIdThird)
|
|
|
if err != nil {
|
|
|
response.Fail("获取报告详情失败"+err.Error(), c)
|
|
|
return
|
|
|
}
|
|
|
+ //查询分类类别,根据分类配置显示专栏还是报告合集
|
|
|
+ minClassify, err := classify.GetByClassifyId(minClassifyId)
|
|
|
+ if err != nil {
|
|
|
+ response.FailMsg("获取分类信息失败", "获取分类信息失败"+err.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
resp := &pcModels.DetailBannerResp{
|
|
|
ReportId: reportItem.ReportId,
|
|
|
Stage: reportItem.Stage,
|
|
|
- VipTitle: reportItem.VipTitle,
|
|
|
+ VipTitle: minClassify.VipTitle,
|
|
|
Author: reportItem.Author,
|
|
|
- ReportAuthor: reportItem.ReportAuthor,
|
|
|
+ ReportAuthor: minClassify.ReportAuthor,
|
|
|
ImgUrl: "",
|
|
|
ClassifyNameFirst: reportItem.ClassifyNameFirst,
|
|
|
ClassifyIdFirst: reportItem.ClassifyIdFirst,
|
|
|
ClassifyNameSecond: reportItem.ClassifyNameSecond,
|
|
|
ClassifyIdSecond: reportItem.ClassifyIdSecond,
|
|
|
- ShowType: parentClassify.ShowType,
|
|
|
+ ShowType: minClassify.ShowType,
|
|
|
}
|
|
|
|
|
|
if parentClassify.ShowType == 1 || parentClassify.ShowType == 3 {
|
|
@@ -350,7 +364,6 @@ 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
|
|
@@ -360,12 +373,26 @@ 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
|
|
|
+ }
|
|
|
+ minClassifyId, _, err := report2.GetMinClassify(reportInfo)
|
|
|
+ if err != nil {
|
|
|
+ response.FailMsg("查询最新一期报告合集失败", "查询最新一期报告合集失败1:"+err.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
var recommendResp []*pcModels.RecommendResp
|
|
|
- if classifyName == "周报" || classifyName == "晨报" {
|
|
|
- recommendList, err := report_chapter.GetWeekRecommendList(reportId, classifyName)
|
|
|
+ if reportInfo.HasChapter == 1 {
|
|
|
+ recommendList, err := report_chapter.GetWeekRecommendListV2(reportId, minClassifyId)
|
|
|
if err != nil {
|
|
|
- response.Fail("获取报告详情失败"+err.Error(), c)
|
|
|
+ response.FailMsg("获取推荐报告列表失败", "获取推荐报告列表失败:"+err.Error(), c)
|
|
|
return
|
|
|
}
|
|
|
for _, chapter := range recommendList {
|
|
@@ -380,15 +407,6 @@ func Recommend(c *gin.Context) {
|
|
|
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
|
|
|
- }
|
|
|
|
|
|
if reportInfo.State != 2 && reportInfo.State != 6 {
|
|
|
response.Fail("报告未发布", c)
|
|
@@ -402,7 +420,7 @@ func Recommend(c *gin.Context) {
|
|
|
reportType = 2
|
|
|
}
|
|
|
|
|
|
- recommendList, err := pcModels.GetRecommendList(reportId, reportType, reportInfo.ClassifyIdSecond)
|
|
|
+ recommendList, err := pcModels.GetRecommendListV2(reportId, reportType, reportInfo.ClassifyIdFirst, reportInfo.ClassifyIdSecond, reportInfo.ClassifyIdThird)
|
|
|
if err != nil {
|
|
|
response.Fail("获取报告详情失败"+err.Error(), c)
|
|
|
return
|