Browse Source

Merge branch 'needs_fix' of hongze/hongze_yb into master

hsun 2 years ago
parent
commit
7884479caf
2 changed files with 24 additions and 16 deletions
  1. 17 16
      models/response/report.go
  2. 7 0
      services/report/report.go

+ 17 - 16
models/response/report.go

@@ -11,6 +11,7 @@ type ReportDetail struct {
 	AuthOk            bool                     `json:"auth_ok"`
 	LikeNum           int64                    `description:"点赞总数" json:"like_num"`
 	LikeEnabled       int8                     `description:"是否已点赞: 0-未点赞 1-已点赞" json:"like_enabled"`
+	ReportShowType    int                      `descritpion:"展示形式:1-列表 2-专栏" json:"report_show_type"`
 }
 
 type ReportChapterListItem struct {
@@ -36,22 +37,22 @@ type ReportItem struct {
 	Author             string    `description:"作者" json:"author"`
 	Frequency          string    `description:"频度" json:"frequency"`
 	PublishTime        time.Time `description:"发布时间" json:"publish_time"`
-	Stage              int    `description:"期数" json:"stage"`
-	Content            string `description:"内容" json:"content"`
-	VideoUrl           string `description:"音频文件URL" json:"video_url"`
-	VideoName          string `description:"音频文件名称" json:"video_name"`
-	VideoSize          string `description:"音频文件大小,单位M" json:"video_size"`
-	VideoPlaySeconds   string `description:"音频播放时长" json:"video_play_seconds"`
+	Stage              int       `description:"期数" json:"stage"`
+	Content            string    `description:"内容" json:"content"`
+	VideoUrl           string    `description:"音频文件URL" json:"video_url"`
+	VideoName          string    `description:"音频文件名称" json:"video_name"`
+	VideoSize          string    `description:"音频文件大小,单位M" json:"video_size"`
+	VideoPlaySeconds   string    `description:"音频播放时长" json:"video_play_seconds"`
 	VideoImg           string    `description:"音频播放条的图片" json:"video_img"`
-	ContentSub         string `description:"内容前两个章节" json:"content_sub"`
-	BannerUrl          string `description:"详情页banner" json:"banner_url"`
+	ContentSub         string    `description:"内容前两个章节" json:"content_sub"`
+	BannerUrl          string    `description:"详情页banner" json:"banner_url"`
 }
 
 type ReportChapterItem struct {
 	ReportChapterId       int       `json:"report_chapter_id"`
 	ReportId              int       `json:"report_id"`
 	Title                 string    `json:"title"`
-	Abstract string `json:"abstract"`
+	Abstract              string    `json:"abstract"`
 	TypeId                int       `json:"type_id"`
 	TypeName              string    `json:"type_name"`
 	Trend                 string    `json:"trend"`
@@ -80,13 +81,13 @@ type ReportChapterDetail struct {
 }
 
 type ReportChapterMenu struct {
-	ReportChapterId    int    `json:"report_chapter_id"`
-	ReportId        int    `json:"report_id"`
-	ReportChapterTypeName   string       `json:"report_chapter_type_name"`
-	ReportChapterTypeThumb  string	    `json:"report_chapter_type_thumb"`
-	PcSelectedThumb  string	    `json:"pc_selected_thumb"`
-	PcUnselectedThumb  string	    `json:"pc_unselected_thumb"`
-	Sort             int  `json:"sort"`
+	ReportChapterId        int    `json:"report_chapter_id"`
+	ReportId               int    `json:"report_id"`
+	ReportChapterTypeName  string `json:"report_chapter_type_name"`
+	ReportChapterTypeThumb string `json:"report_chapter_type_thumb"`
+	PcSelectedThumb        string `json:"pc_selected_thumb"`
+	PcUnselectedThumb      string `json:"pc_unselected_thumb"`
+	Sort                   int    `json:"sort"`
 }
 
 type ReportListItem struct {

+ 7 - 0
services/report/report.go

@@ -393,6 +393,12 @@ func GetReportDetail(userinfo user.UserInfo, reportId int) (reportDetail respons
 		err = errors.New("报告未发布")
 		return
 	}
+	// 判断报告是否属于专栏报告
+	firstClassify, e := classify.GetByClassifyId(reportInfo.ClassifyIdFirst)
+	if e != nil {
+		err = errors.New("报告一级分类有误")
+		return
+	}
 
 	//判断权限
 
@@ -486,6 +492,7 @@ func GetReportDetail(userinfo user.UserInfo, reportId int) (reportDetail respons
 	reportDetail.AuthOk = authOk
 	reportDetail.LikeNum = likeNum
 	reportDetail.LikeEnabled = likeEnabled
+	reportDetail.ReportShowType = int(firstClassify.ShowType)
 	return
 }