|
@@ -12,6 +12,7 @@ import (
|
|
"hongze/hongze_yb/models/tables/research_report_type"
|
|
"hongze/hongze_yb/models/tables/research_report_type"
|
|
"hongze/hongze_yb/models/tables/user_view_history"
|
|
"hongze/hongze_yb/models/tables/user_view_history"
|
|
"hongze/hongze_yb/models/tables/wx_user"
|
|
"hongze/hongze_yb/models/tables/wx_user"
|
|
|
|
+ "hongze/hongze_yb/services"
|
|
"hongze/hongze_yb/utils"
|
|
"hongze/hongze_yb/utils"
|
|
"strconv"
|
|
"strconv"
|
|
"time"
|
|
"time"
|
|
@@ -22,6 +23,8 @@ type ResearchReportInfo struct {
|
|
ResearchReportTypeList []*company_report_permission.ResearchReportTypeList `json:"research_report_type_list"`
|
|
ResearchReportTypeList []*company_report_permission.ResearchReportTypeList `json:"research_report_type_list"`
|
|
HasMenu int `json:"has_menu"`
|
|
HasMenu int `json:"has_menu"`
|
|
ResearchReportTypeContentList []*research_report.ResearchReportTypeContent `description:"报告详情"`
|
|
ResearchReportTypeContentList []*research_report.ResearchReportTypeContent `description:"报告详情"`
|
|
|
|
+ LikeNum int64 `description:"点赞总数" json:"like_num"`
|
|
|
|
+ LikeEnabled int8 `description:"是否已点赞: 0-未点赞 1-已点赞" json:"like_enabled"`
|
|
}
|
|
}
|
|
|
|
|
|
// GetResearchReportInfo 获取报告详情
|
|
// GetResearchReportInfo 获取报告详情
|
|
@@ -122,14 +125,19 @@ func GetResearchReportInfo(researchReportId, userId uint64) (result ResearchRepo
|
|
//添加阅读日志的数据加入到redis
|
|
//添加阅读日志的数据加入到redis
|
|
go PushViewRecordNewRedisData(userViewHistory, int(wxUserInfo.CompanyID))
|
|
go PushViewRecordNewRedisData(userViewHistory, int(wxUserInfo.CompanyID))
|
|
|
|
|
|
|
|
+ //查询点赞数
|
|
|
|
+ likeNum,likeEnabled, _ := services.GetReportLikeByReportIdOldReportId(wxUserInfo.UserID, 0, 0, int(researchReportId),0)
|
|
|
|
+
|
|
result = ResearchReportInfo{
|
|
result = ResearchReportInfo{
|
|
ResearchReportInfo: reportInfo,
|
|
ResearchReportInfo: reportInfo,
|
|
ResearchReportTypeList: researchReportTypeList,
|
|
ResearchReportTypeList: researchReportTypeList,
|
|
HasMenu: 1,
|
|
HasMenu: 1,
|
|
|
|
+ LikeNum: likeNum,
|
|
|
|
+ LikeEnabled: likeEnabled,
|
|
}
|
|
}
|
|
|
|
|
|
if len(researchReportTypeList) <= 0 {
|
|
if len(researchReportTypeList) <= 0 {
|
|
-
|
|
|
|
|
|
+
|
|
} else if len(researchReportTypeList) == 1 {
|
|
} else if len(researchReportTypeList) == 1 {
|
|
//只有一个章节,即没有目录的时候,需要直接返回章节详情
|
|
//只有一个章节,即没有目录的时候,需要直接返回章节详情
|
|
result.HasMenu = 0
|
|
result.HasMenu = 0
|
|
@@ -146,6 +154,8 @@ type ResearchReportTypeContentInfo struct {
|
|
ResearchReportTypeInfo *research_report_type.ResearchReportTypeInfo `json:"research_report_type_info"`
|
|
ResearchReportTypeInfo *research_report_type.ResearchReportTypeInfo `json:"research_report_type_info"`
|
|
Add int `json:"add"`
|
|
Add int `json:"add"`
|
|
ResearchReportTypeContentList []*research_report.ResearchReportTypeContent `description:"报告详情" json:"research_report_type_content_list"`
|
|
ResearchReportTypeContentList []*research_report.ResearchReportTypeContent `description:"报告详情" json:"research_report_type_content_list"`
|
|
|
|
+ LikeNum int64 `description:"点赞总数" json:"like_num"`
|
|
|
|
+ LikeEnabled int8 `description:"是否已点赞: 0-未点赞 1-已点赞" json:"like_enabled"`
|
|
}
|
|
}
|
|
|
|
|
|
// GetResearchReportTypeContentInfo 获取报告章节详情
|
|
// GetResearchReportTypeContentInfo 获取报告章节详情
|
|
@@ -247,10 +257,14 @@ func GetResearchReportTypeContentInfo(researchReportTypeId, userId uint64) (resu
|
|
//添加阅读日志的数据加入到redis
|
|
//添加阅读日志的数据加入到redis
|
|
go PushViewRecordNewRedisData(userViewHistory, int(wxUserInfo.CompanyID))
|
|
go PushViewRecordNewRedisData(userViewHistory, int(wxUserInfo.CompanyID))
|
|
|
|
|
|
|
|
+ //查询点赞数
|
|
|
|
+ likeNum,likeEnabled, _ := services.GetReportLikeByReportIdOldReportId(wxUserInfo.UserID, 0, 0, int(researchReportTypeInfo.ResearchReportID), int(researchReportTypeInfo.ResearchReportTypeID))
|
|
result = ResearchReportTypeContentInfo{
|
|
result = ResearchReportTypeContentInfo{
|
|
ResearchReportTypeContentList: researchReportTypeContentList,
|
|
ResearchReportTypeContentList: researchReportTypeContentList,
|
|
ResearchReportTypeInfo: researchReportTypeInfo,
|
|
ResearchReportTypeInfo: researchReportTypeInfo,
|
|
Add: add,
|
|
Add: add,
|
|
|
|
+ LikeNum: likeNum,
|
|
|
|
+ LikeEnabled: likeEnabled,
|
|
}
|
|
}
|
|
return
|
|
return
|
|
}
|
|
}
|