Quellcode durchsuchen

Merge branch 'fix/1.8.3'

Roc vor 5 Monaten
Ursprung
Commit
e571fed70b

+ 47 - 44
models/response/report.go

@@ -5,15 +5,16 @@ import (
 )
 
 type ReportDetail struct {
-	ReportInfo        *ReportItem              `json:"report_info"`
-	ReportChapterList []*ReportChapterListItem `json:"report_chapter_list"`
-	PermissionCheck   *PermissionCheckInfo     `json:"permission_check"`
-	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"`
-	CollectionId      int                      `description:"收藏ID: 大于0则表示已收藏" json:"collection_id"`
-	RoadVideoId       int                      `json:"road_video_id" description:"绑定的路演视频ID"`
+	ReportInfo           *ReportItem              `json:"report_info"`
+	ReportChapterList    []*ReportChapterListItem `json:"report_chapter_list"`
+	PermissionCheck      *PermissionCheckInfo     `json:"permission_check"`
+	AuthOk               bool                     `json:"auth_ok"`
+	LikeNum              int64                    `description:"点赞总数" json:"like_num"`
+	LikeEnabled          int8                     `description:"是否已点赞: 0-未点赞 1-已点赞" json:"like_enabled"`
+	ReportShowType       int                      `description:"展示形式:1-列表 2-专栏" json:"report_show_type"`
+	CollectionId         int                      `description:"收藏ID: 大于0则表示已收藏" json:"collection_id"`
+	RoadVideoId          int                      `json:"road_video_id" description:"绑定的路演视频ID"`
+	ReportDetailShowType int                      `description:"报告详情的展示类型:1-拼接;2:目录" json:"report_detail_show_type"`
 }
 
 type ReportChapterListItem struct {
@@ -29,6 +30,7 @@ type ReportChapterListItem struct {
 	Sort                   int       `json:"sort"`
 	PublishTime            time.Time `json:"publish_time"`
 	IsClose                int       `gorm:"column:is_close;type:tinyint(1);default:0" json:"is_close"` //音频品种是否关闭
+	Content                string    `description:"内容" json:"content"`
 	VideoUrl               string    `json:"video_url" description:"音频文件URL"`
 	VideoName              string    `json:"video_name" description:"音频文件名称"`
 	VideoPlaySeconds       string    `json:"video_play_seconds" description:"音频播放时长"`
@@ -115,29 +117,29 @@ type ReportChapterMenu struct {
 }
 
 type ReportListItem struct {
-	ReportId           int              `description:"报告Id" json:"report_id"`
-	ClassifyIdFirst    int              `description:"一级分类id" json:"classify_id_first"`
-	ClassifyNameFirst  string           `description:"一级分类名称" json:"classify_name_first"`
-	ClassifyIdSecond   int              `description:"二级分类id" json:"classify_id_second"`
-	ClassifyNameSecond string           `description:"二级分类名称" json:"classify_name_second"`
-	ClassifyIdThird    int              `description:"三级分类id" json:"classify_id_third"`
-	ClassifyNameThird  string           `description:"三级分类名称" json:"classify_name_third"`
-	Title              string           `description:"标题" json:"title"`
-	Abstract           string           `description:"摘要" json:"abstract"`
-	Author             string           `description:"作者" json:"author"`
-	ReportImgUrl       string           `description:"作者头像" json:"report_img_url"`
-	PublishTime        time.Time        `description:"发布时间" json:"publish_time"`
-	Stage              int              `description:"期数" json:"stage"`
-	VideoList          []*VideoListItem `json:"video_list"`
-	AuthOk             bool             `json:"auth_ok"`
-	TitleInfo          string           `json:"title_info"`
-	HasChapter         int              `description:"是否有章节" json:"has_chapter"`
-	VideoUrl           string           `description:"报告音频" 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           `json:"video_img"` // 音频播放条前面展示的图片
-
+	ReportId             int              `description:"报告Id" json:"report_id"`
+	ClassifyIdFirst      int              `description:"一级分类id" json:"classify_id_first"`
+	ClassifyNameFirst    string           `description:"一级分类名称" json:"classify_name_first"`
+	ClassifyIdSecond     int              `description:"二级分类id" json:"classify_id_second"`
+	ClassifyNameSecond   string           `description:"二级分类名称" json:"classify_name_second"`
+	ClassifyIdThird      int              `description:"三级分类id" json:"classify_id_third"`
+	ClassifyNameThird    string           `description:"三级分类名称" json:"classify_name_third"`
+	Title                string           `description:"标题" json:"title"`
+	Abstract             string           `description:"摘要" json:"abstract"`
+	Author               string           `description:"作者" json:"author"`
+	ReportImgUrl         string           `description:"作者头像" json:"report_img_url"`
+	PublishTime          time.Time        `description:"发布时间" json:"publish_time"`
+	Stage                int              `description:"期数" json:"stage"`
+	VideoList            []*VideoListItem `json:"video_list"`
+	AuthOk               bool             `json:"auth_ok"`
+	TitleInfo            string           `json:"title_info"`
+	HasChapter           int              `description:"是否有章节" json:"has_chapter"`
+	VideoUrl             string           `description:"报告音频" 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           `json:"video_img"` // 音频播放条前面展示的图片
+	ReportDetailShowType int              `description:"报告详情的展示类型:1-拼接;2:目录" json:"report_detail_show_type"`
 }
 
 type VideoListItem struct {
@@ -154,18 +156,19 @@ type ReportList struct {
 }
 
 type ReportCollectListItem struct {
-	ReportId            int       `description:"报告Id" json:"report_id"`
-	ReportChapterId     int       `json:"report_chapter_id"`
-	ClassifyIdFirst     int       `description:"一级分类id" json:"classify_id_first"`
-	ClassifyNameFirst   string    `description:"一级分类名称" json:"classify_name_first"`
-	ClassifyIdSecond    int       `description:"二级分类id" json:"classify_id_second"`
-	ClassifyNameSecond  string    `description:"二级分类名称" json:"classify_name_second"`
-	ReportChapterTypeId int       `json:"report_chapter_type_id"`
-	PublishTime         time.Time `description:"发布时间" json:"publish_time"`
-	Title               string    `description:"标题" json:"title"`
-	ContentSub          string    `description:"内容前两个章节" json:"content_sub"`
-	ClassifyId          int       `description:"最小分类id" json:"classify_id"`
-	ClassifyName        string    `description:"最小分类名称" json:"classify_name"`
+	ReportId             int       `description:"报告Id" json:"report_id"`
+	ReportChapterId      int       `json:"report_chapter_id"`
+	ClassifyIdFirst      int       `description:"一级分类id" json:"classify_id_first"`
+	ClassifyNameFirst    string    `description:"一级分类名称" json:"classify_name_first"`
+	ClassifyIdSecond     int       `description:"二级分类id" json:"classify_id_second"`
+	ClassifyNameSecond   string    `description:"二级分类名称" json:"classify_name_second"`
+	ReportChapterTypeId  int       `json:"report_chapter_type_id"`
+	PublishTime          time.Time `description:"发布时间" json:"publish_time"`
+	Title                string    `description:"标题" json:"title"`
+	ContentSub           string    `description:"内容前两个章节" json:"content_sub"`
+	ClassifyId           int       `description:"最小分类id" json:"classify_id"`
+	ClassifyName         string    `description:"最小分类名称" json:"classify_name"`
+	ReportDetailShowType int       `description:"报告详情的展示类型:1-拼接;2:目录" json:"report_detail_show_type"`
 }
 
 type ReportCollectList struct {

+ 32 - 31
models/tables/rddp/classify/classify.go

@@ -3,37 +3,38 @@ package classify
 import "time"
 
 type Classify struct {
-	Id                int       `gorm:"column:id" db:"id" json:"id" form:"id"`
-	ClassifyName      string    `gorm:"column:classify_name" db:"classify_name" json:"classify_name" form:"classify_name"` //分类名称
-	Sort              int8      `gorm:"column:sort" db:"sort" json:"sort" form:"sort"`                                     //排序
-	ParentId          int       `gorm:"column:parent_id" db:"parent_id" json:"parent_id" form:"parent_id"`                 //父级分类id
-	CreateTime        time.Time `gorm:"column:create_time" db:"create_time" json:"create_time" form:"create_time"`
-	ModifyTime        time.Time `gorm:"column:modify_time" db:"modify_time" json:"modify_time" form:"modify_time"`
-	Abstract          string    `gorm:"column:abstract" db:"abstract" json:"abstract" form:"abstract"`                             //栏目简介
-	Descript          string    `gorm:"column:descript" db:"descript" json:"descript" form:"descript"`                             //分享描述
-	ReportAuthor      string    `gorm:"column:report_author" db:"report_author" json:"report_author" form:"report_author"`         //栏目作者
-	AuthorDescript    string    `gorm:"column:author_descript" db:"author_descript" json:"author_descript" form:"author_descript"` //作者简介
-	ReportImgUrl      string    `gorm:"column:report_img_url" db:"report_img_url" json:"report_img_url" form:"report_img_url"`     //报告配图
-	HeadImgUrl        string    `gorm:"column:head_img_url" db:"head_img_url" json:"head_img_url" form:"head_img_url"`             //头部banner
-	AvatarImgUrl      string    `gorm:"column:avatar_img_url" db:"avatar_img_url" json:"avatar_img_url" form:"avatar_img_url"`     //头像
-	ColumnImgUrl      string    `gorm:"column:column_img_url" db:"column_img_url" json:"column_img_url" form:"column_img_url"`     //栏目配图
-	IsHomeColumn      int8      `gorm:"column:is_home_column" db:"is_home_column" json:"is_home_column" form:"is_home_column"`     //1:首页专栏
-	HomeImgUrl        string    `gorm:"column:home_img_url" db:"home_img_url" json:"home_img_url" form:"home_img_url"`             //首页配图
-	ClassifyLabel     string    `gorm:"column:classify_label" db:"classify_label" json:"classify_label" form:"classify_label"`
-	ShowType          uint8     `gorm:"column:show_type" db:"show_type" json:"show_type" form:"show_type"`                                     //展示类型:1-列表 2-专栏
-	HasTeleconference uint8     `gorm:"column:has_teleconference" db:"has_teleconference" json:"has_teleconference" form:"has_teleconference"` //是否有电话会 0-否 1-是
-	VipTitle          string    `gorm:"column:vip_title" db:"vip_title" json:"vip_title" form:"vip_title"`                                     //研究员头衔
-	YbIconUrl         string    `gorm:"column:yb_icon_url" db:"yb_icon_url" json:"yb_icon_url" form:"yb_icon_url"`                             //研报3.0已购页面icon图片地址
-	YbBgUrl           string    `gorm:"column:yb_bg_url" db:"yb_bg_url" json:"yb_bg_url" form:"yb_bg_url"`                                     //研报3.0已购详情背景图地址
-	IsShow            int8      `gorm:"column:is_show" db:"is_show" json:"is_show" form:"is_show"`                                             //是否展示报告:1,展示该分类下的报告,0隐藏分类下的报告
-	YbFiccIcon        string    `gorm:"column:yb_ficc_icon" db:"yb_ficc_icon" json:"yb_ficc_icon" form:"yb_ficc_icon"`                         //研报小程序端ficc页码图标
-	YbFiccPcIcon      string    `gorm:"column:yb_ficc_pc_icon" db:"yb_ficc_pc_icon" json:"yb_ficc_pc_icon" form:"yb_ficc_pc_icon"`             //研报 pc端ficc页码图标
-	YbFiccSort        int       `gorm:"column:yb_ficc_sort" db:"yb_ficc_sort" json:"yb_ficc_sort" form:"yb_ficc_sort"`                         //研报小程序端ficc页面排序
-	YbListImg         string    `gorm:"column:yb_list_img" db:"yb_list_img" json:"yb_list_img" form:"yb_list_img"`                             //研报小程序端报告列表封面图
-	YbShareBgImg      string    `gorm:"column:yb_share_bg_img;" db:"yb_share_bg_img" json:"yb_share_bg_img" form:"yb_share_bg_img"`
-	YbRightBanner     string    `gorm:"column:yb_right_banner;" db:"yb_right_banner" json:"yb_right_banner" form:"yb_right_banner"` // 研报小程序-报告分享背景图
-	Level             int       `gorm:"column:level" db:"level" json:"level" form:"level"`                                          // 层级
-	HasChild          int       `gorm:"column:has_child" db:"has_child" json:"has_child" form:"has_child"`                          //是否有子级别,0:下面没有子分类,1:下面有子分类;默认:0
+	Id                   int       `gorm:"column:id" db:"id" json:"id" form:"id"`
+	ClassifyName         string    `gorm:"column:classify_name" db:"classify_name" json:"classify_name" form:"classify_name"` //分类名称
+	Sort                 int8      `gorm:"column:sort" db:"sort" json:"sort" form:"sort"`                                     //排序
+	ParentId             int       `gorm:"column:parent_id" db:"parent_id" json:"parent_id" form:"parent_id"`                 //父级分类id
+	CreateTime           time.Time `gorm:"column:create_time" db:"create_time" json:"create_time" form:"create_time"`
+	ModifyTime           time.Time `gorm:"column:modify_time" db:"modify_time" json:"modify_time" form:"modify_time"`
+	Abstract             string    `gorm:"column:abstract" db:"abstract" json:"abstract" form:"abstract"`                             //栏目简介
+	Descript             string    `gorm:"column:descript" db:"descript" json:"descript" form:"descript"`                             //分享描述
+	ReportAuthor         string    `gorm:"column:report_author" db:"report_author" json:"report_author" form:"report_author"`         //栏目作者
+	AuthorDescript       string    `gorm:"column:author_descript" db:"author_descript" json:"author_descript" form:"author_descript"` //作者简介
+	ReportImgUrl         string    `gorm:"column:report_img_url" db:"report_img_url" json:"report_img_url" form:"report_img_url"`     //报告配图
+	HeadImgUrl           string    `gorm:"column:head_img_url" db:"head_img_url" json:"head_img_url" form:"head_img_url"`             //头部banner
+	AvatarImgUrl         string    `gorm:"column:avatar_img_url" db:"avatar_img_url" json:"avatar_img_url" form:"avatar_img_url"`     //头像
+	ColumnImgUrl         string    `gorm:"column:column_img_url" db:"column_img_url" json:"column_img_url" form:"column_img_url"`     //栏目配图
+	IsHomeColumn         int8      `gorm:"column:is_home_column" db:"is_home_column" json:"is_home_column" form:"is_home_column"`     //1:首页专栏
+	HomeImgUrl           string    `gorm:"column:home_img_url" db:"home_img_url" json:"home_img_url" form:"home_img_url"`             //首页配图
+	ClassifyLabel        string    `gorm:"column:classify_label" db:"classify_label" json:"classify_label" form:"classify_label"`
+	ShowType             uint8     `gorm:"column:show_type" db:"show_type" json:"show_type" form:"show_type"`                                     //展示类型:1-列表 2-专栏
+	HasTeleconference    uint8     `gorm:"column:has_teleconference" db:"has_teleconference" json:"has_teleconference" form:"has_teleconference"` //是否有电话会 0-否 1-是
+	VipTitle             string    `gorm:"column:vip_title" db:"vip_title" json:"vip_title" form:"vip_title"`                                     //研究员头衔
+	YbIconUrl            string    `gorm:"column:yb_icon_url" db:"yb_icon_url" json:"yb_icon_url" form:"yb_icon_url"`                             //研报3.0已购页面icon图片地址
+	YbBgUrl              string    `gorm:"column:yb_bg_url" db:"yb_bg_url" json:"yb_bg_url" form:"yb_bg_url"`                                     //研报3.0已购详情背景图地址
+	IsShow               int8      `gorm:"column:is_show" db:"is_show" json:"is_show" form:"is_show"`                                             //是否展示报告:1,展示该分类下的报告,0隐藏分类下的报告
+	YbFiccIcon           string    `gorm:"column:yb_ficc_icon" db:"yb_ficc_icon" json:"yb_ficc_icon" form:"yb_ficc_icon"`                         //研报小程序端ficc页码图标
+	YbFiccPcIcon         string    `gorm:"column:yb_ficc_pc_icon" db:"yb_ficc_pc_icon" json:"yb_ficc_pc_icon" form:"yb_ficc_pc_icon"`             //研报 pc端ficc页码图标
+	YbFiccSort           int       `gorm:"column:yb_ficc_sort" db:"yb_ficc_sort" json:"yb_ficc_sort" form:"yb_ficc_sort"`                         //研报小程序端ficc页面排序
+	YbListImg            string    `gorm:"column:yb_list_img" db:"yb_list_img" json:"yb_list_img" form:"yb_list_img"`                             //研报小程序端报告列表封面图
+	YbShareBgImg         string    `gorm:"column:yb_share_bg_img;" db:"yb_share_bg_img" json:"yb_share_bg_img" form:"yb_share_bg_img"`
+	YbRightBanner        string    `gorm:"column:yb_right_banner;" db:"yb_right_banner" json:"yb_right_banner" form:"yb_right_banner"`                                // 研报小程序-报告分享背景图
+	Level                int       `gorm:"column:level" db:"level" json:"level" form:"level"`                                                                         // 层级
+	HasChild             int       `gorm:"column:has_child" db:"has_child" json:"has_child" form:"has_child"`                                                         //是否有子级别,0:下面没有子分类,1:下面有子分类;默认:0
+	ReportDetailShowType uint8     `gorm:"column:report_detail_show_type" db:"report_detail_show_type" json:"report_detail_show_type" form:"report_detail_show_type"` // 报告详情的展示类型:1-拼接;2:目录
 }
 
 func (c *Classify) TableName() string {

+ 1 - 0
models/tables/rddp/report/report.go

@@ -36,6 +36,7 @@ type Report struct {
 	CanvasColor        string    `description:"画布颜色" json:"canvas_color"`
 	HeadResourceId     int       `description:"版头资源ID" json:"head_resource_id"`
 	EndResourceId      int       `description:"版尾资源ID" json:"end_resource_id"`
+	VoiceGenerateType  int8      `description:"音频生成方式,0:系统生成,1:人工上传" json:"voice_generate_type"`
 }
 
 type UnReadItem struct {

+ 1 - 0
models/tables/rddp/report_chapter/report_chapter.go

@@ -29,6 +29,7 @@ type ReportChapter struct {
 	CreateTime        time.Time `gorm:"column:create_time;type:datetime"  json:"create_time"`                                       //创建时间
 	ModifyTime        time.Time `gorm:"column:modify_time;type:datetime"  json:"modify_time"`                                       //修改时间
 	ReportLayout      int8      `description:"报告布局,1:常规布局,2:智能布局。默认:1" json:"report_layout"`
+	VoiceGenerateType int8      `description:"音频生成方式,0:系统生成,1:人工上传" json:"voice_generate_type"`
 }
 
 func (r *ReportChapter) TableName() string {

+ 40 - 15
models/tables/yb_comment/query.go

@@ -5,12 +5,18 @@ import (
 	"hongze/hongze_yb/utils"
 )
 
-
 // GetListByUserIdReportId 获取用户的留言列表
 func GetListByUserIdReportId(userId uint64, reportId, reportChapterId int) (list []*YbComment, err error) {
-	err = global.DEFAULT_MYSQL.Model(YbComment{}).
-		Where("user_id = ? and report_id = ? and report_chapter_id = ? and enabled = 1 ", userId, reportId, reportChapterId).
-		Order("create_time desc, comment_id desc").
+	//err = global.DEFAULT_MYSQL.Model(YbComment{}).
+	//	Where("user_id = ? and report_id = ? and report_chapter_id = ? and enabled = 1 ", userId, reportId, reportChapterId).
+	//	Order("create_time desc, comment_id desc").
+	//	Scan(&list).Error
+	tmp := global.DEFAULT_MYSQL.Model(YbComment{}).
+		Where("user_id = ? and report_id = ? and enabled = 1 ", userId, reportId)
+	if reportChapterId > 0 {
+		tmp = tmp.Where("report_chapter_id = ?", reportChapterId)
+	}
+	err = tmp.Order("create_time desc, comment_id desc").
 		Scan(&list).Error
 	if err == utils.ErrNoRow {
 		err = nil
@@ -32,20 +38,39 @@ func GetListByUserIdOldReportId(userId uint64, oldReportId, oldReportChapterId i
 
 // GetHotListByReportId 获取报告的精选留言列表
 func GetHotListByReportId(reportId, reportChapterId int, offset, limit int) (list []*YbComment, err error) {
-	err = global.DEFAULT_MYSQL.Model(YbComment{}).
-		Where("report_id = ? and report_chapter_id = ? and enabled = 1 and is_hot = 1 and type = 1", reportId, reportChapterId).
-		Order("is_top desc, hot_top_time desc, comment_id desc").
+	//err = global.DEFAULT_MYSQL.Model(YbComment{}).
+	//	Where("report_id = ? and report_chapter_id = ? and enabled = 1 and is_hot = 1 and type = 1", reportId, reportChapterId).
+	//	Order("is_top desc, hot_top_time desc, comment_id desc").
+	//	Offset(offset).
+	//	Limit(limit).
+	//	Scan(&list).Error
+
+	tmp := global.DEFAULT_MYSQL.Model(YbComment{}).
+		Where("report_id = ? and enabled = 1 and is_hot = 1 and type = 1", reportId)
+
+	// 如果有填写章节id,那么就查询章节id
+	if reportChapterId > 0 {
+		tmp = tmp.Where("report_chapter_id = ? ", reportChapterId)
+	}
+
+	err = tmp.Order("is_top desc, hot_top_time desc, comment_id desc").
 		Offset(offset).
 		Limit(limit).
 		Scan(&list).Error
+
 	return
 }
 
 // GetHotListTotalByReportId 获取精选留言总条数
-func GetHotListTotalByReportId(reportId, reportChapterId int)(total int64, err error)  {
-	err = global.DEFAULT_MYSQL.Model(YbComment{}).
-		Where("report_id = ? and report_chapter_id = ? and enabled = 1 and is_hot = 1 and type = 1", reportId, reportChapterId).
-		Count(&total).Error
+func GetHotListTotalByReportId(reportId, reportChapterId int) (total int64, err error) {
+	tmp := global.DEFAULT_MYSQL.Model(YbComment{}).
+		Where("report_id = ? and enabled = 1 and is_hot = 1 and type = 1", reportId)
+	// 如果有填写章节id,那么就查询章节id
+	if reportChapterId > 0 {
+		tmp = tmp.Where(" report_chapter_id = ? ", reportChapterId)
+	}
+	err = tmp.Count(&total).Error
+
 	return
 }
 
@@ -61,7 +86,7 @@ func GetHotListByOldReportId(oldReportId, oldReportChapterId int, offset, limit
 }
 
 // GetHotListTotalByOldReportId 获取老报告的精选留言总条数
-func GetHotListTotalByOldReportId(oldReportId, oldReportChapterId int)(total int64, err error)  {
+func GetHotListTotalByOldReportId(oldReportId, oldReportChapterId int) (total int64, err error) {
 	err = global.DEFAULT_MYSQL.Model(YbComment{}).
 		Where("old_report_id = ? and old_report_chapter_id = ? and enabled = 1 and is_hot = 1 and type = 1", oldReportId, oldReportChapterId).
 		Count(&total).Error
@@ -78,7 +103,7 @@ func GetReplyListByReplyCommentId(replyCommentIds []uint64) (list []*YbComment,
 }
 
 // GetSimpleByCommentId 根据留言ID,查询留言
-func GetSimpleByCommentId(commentId uint64)(item *YbComment, err error)  {
+func GetSimpleByCommentId(commentId uint64) (item *YbComment, err error) {
 	err = global.DEFAULT_MYSQL.Model(YbComment{}).
 		Select("comment_id, user_id, type, enabled").
 		Where("comment_id = ?", commentId).First(&item).Error
@@ -89,9 +114,9 @@ func GetSimpleByCommentId(commentId uint64)(item *YbComment, err error)  {
 }
 
 // GetMyLatestComment 获取用户最新的留言
-func GetMyLatestComment(userId uint64) (item *YbComment, err error){
+func GetMyLatestComment(userId uint64) (item *YbComment, err error) {
 	err = global.DEFAULT_MYSQL.Model(YbComment{}).
 		Select("comment_id, user_id, type, enabled, is_show_name").
 		Where("user_id = ? and type=1", userId).Order("comment_id desc").First(&item).Error
 	return
-}
+}

+ 1 - 1
services/company/permission.go

@@ -746,8 +746,8 @@ func GetHomeFiccPermissions(user user.UserInfo) (ret response.PermissionFiccResp
 		if len(v.List) > 0 {
 			temp.List = v.List
 			sort.Sort(temp.List)
+			list = append(list, temp)
 		}
-		list = append(list, temp)
 	}
 
 	if len(list) > 0 {

+ 51 - 2
services/report/report.go

@@ -398,6 +398,9 @@ func GetReportDetail(userinfo user.UserInfo, reportId int) (reportDetail respons
 		err = errors.New("报告未发布")
 		return
 	}
+	// 获取最小分类
+	minClassifyId, _, err := GetMinClassify(reportInfo)
+
 	// 判断报告是否属于专栏报告
 	firstClassify, e := classify.GetByClassifyId(reportInfo.ClassifyIdFirst)
 	if e != nil {
@@ -405,6 +408,18 @@ func GetReportDetail(userinfo user.UserInfo, reportId int) (reportDetail respons
 		return
 	}
 
+	// 最小分类
+	var minClassify *classify.Classify
+	if reportInfo.ClassifyIdFirst == minClassifyId {
+		minClassify = firstClassify
+	} else {
+		minClassify, e = classify.GetByClassifyId(minClassifyId)
+		if e != nil {
+			err = errors.New("报告最小层级分类有误")
+			return
+		}
+	}
+
 	//判断权限
 
 	var authOk bool
@@ -600,6 +615,18 @@ func GetReportDetail(userinfo user.UserInfo, reportId int) (reportDetail respons
 	reportDetail.LikeNum = likeNum
 	reportDetail.LikeEnabled = likeEnabled
 	reportDetail.ReportShowType = int(firstClassify.ShowType)
+	reportDetail.ReportDetailShowType = int(minClassify.ReportDetailShowType)
+
+	// 如果分类配置是列表展示,那么就移除content内容
+	if minClassify.ReportDetailShowType == 2 {
+		for _, v := range reportTypeList {
+			v.Content = ``
+		}
+	} else {
+		for _, v := range reportTypeList {
+			v.Content = html.UnescapeString(v.Content)
+		}
+	}
 
 	// 收藏
 	collectionId, e := collection.GetUserCollectByItem(int(userinfo.UserID), collection.CollectionTypeReport, reportId, 0)
@@ -923,12 +950,14 @@ func GetReportList(user user.UserInfo, keyWord string, classifyIdFirst, classify
 			err = errors.New("获取报告分类列表失败" + e.Error())
 			return
 		}
-		listImgMap := make(map[int]string, 0)
-		classifyNameMap := make(map[int]string, 0)
+		listImgMap := make(map[int]string)
+		classifyNameMap := make(map[int]string)
+		classifyMap := make(map[int]*classify.Classify)
 		classifyLen := len(classifyList)
 		for i := 0; i < classifyLen; i++ {
 			listImgMap[classifyList[i].Id] = classifyList[i].YbListImg
 			classifyNameMap[classifyList[i].Id] = classifyList[i].ClassifyName
+			classifyMap[classifyList[i].Id] = classifyList[i]
 		}
 
 		var videoReportIds []int
@@ -1052,6 +1081,20 @@ func GetReportList(user user.UserInfo, keyWord string, classifyIdFirst, classify
 				reportItem.AuthOk = authOk
 			}
 
+			// 报告详情展示形式
+			{
+				minClassifyId := reportItem.ClassifyIdThird
+				if minClassifyId <= 0 {
+					minClassifyId = reportItem.ClassifyIdSecond
+				}
+				if minClassifyId <= 0 {
+					minClassifyId = reportItem.ClassifyIdFirst
+				}
+				if tmpClassify, ok := classifyMap[minClassifyId]; ok {
+					reportItem.ReportDetailShowType = int(tmpClassify.ReportDetailShowType)
+				}
+			}
+
 			reportList = append(reportList, reportItem)
 		}
 
@@ -1258,6 +1301,7 @@ func SearchReport(user user.UserInfo, keyWord string, pageIndex, pageSize int) (
 	classifyIdList := make([]int, 0)
 	var classifyIdFirsts []int
 	classifyIdSeconds := []int{0}
+	classifyMap := make(map[int]*classify.Classify)
 	for _, v := range classifys {
 		if v.ParentId == 0 {
 			classifyIdFirsts = append(classifyIdFirsts, v.Id)
@@ -1265,6 +1309,7 @@ func SearchReport(user user.UserInfo, keyWord string, pageIndex, pageSize int) (
 			classifyIdSeconds = append(classifyIdSeconds, v.Id)
 		}
 		classifyIdList = append(classifyIdList, v.Id)
+		classifyMap[v.Id] = v
 	}
 	keyWord = addAliasToKeyword(keyWord)
 	searchResp, total, err := elasticService.SearchReport(keyWord, classifyIdList, pageIndex, pageSize)
@@ -1317,6 +1362,10 @@ func SearchReport(user user.UserInfo, keyWord string, pageIndex, pageSize int) (
 			//	}
 			//}
 			temp.ContentSub = GetReportContentSub(temp.ContentSub, false)
+
+			if tmpClassify, ok := classifyMap[temp.ClassifyId]; ok {
+				temp.ReportDetailShowType = int(tmpClassify.ReportDetailShowType)
+			}
 			reportList = append(reportList, temp)
 		}
 	}

+ 6 - 1
services/report/report_chapter.go

@@ -261,7 +261,11 @@ func GetChapterDetail(user user.UserInfo, reportChapterId int) (reportChapterDet
 	reportChapterItem.HeadImg = reportInfo.HeadImg
 	reportChapterItem.EndImg = reportInfo.EndImg
 	reportChapterItem.CanvasColor = reportInfo.CanvasColor
-	reportChapterItem.ReportVideoUrl = reportInfo.VideoUrl
+
+	// 手工上传的才返回
+	if reportInfo.VoiceGenerateType == 1 {
+		reportChapterItem.ReportVideoUrl = reportInfo.VideoUrl
+	}
 
 	// 版头版尾样式
 	{
@@ -647,6 +651,7 @@ func GetChapterListByReportChapterIdList(classifyNameFirst string, reportId int,
 		temp.VideoName = item.VideoName
 		temp.VideoPlaySeconds = item.VideoPlaySeconds
 		temp.VideoSize = item.VideoSize
+		temp.Content = item.Content
 
 		// 系统配置的参数,只有配置的章节类型,才能赋值
 		if typeItem != nil {

+ 4 - 4
services/yb_common.go

@@ -99,10 +99,10 @@ func CheckReportExistByReportIdReportChapterId(reportId, reportChapterId int) (e
 		return
 	}
 
-	if reportInfo.HasChapter == 1 && reportChapterId <= 0 {
-		err = errors.New("请输入报告章节ID")
-		return
-	}
+	//if reportInfo.HasChapter == 1 && reportChapterId <= 0 {
+	//	err = errors.New("请输入报告章节ID")
+	//	return
+	//}
 
 	if reportChapterId > 0 {
 		reportChapterInfo, tErr := report_chapter.GetTypeIdById(reportChapterId)