Quellcode durchsuchen

fix: timeformat

hsun vor 2 Jahren
Ursprung
Commit
278f8ee3ba
1 geänderte Dateien mit 44 neuen und 5 gelöschten Zeilen
  1. 44 5
      logic/report/research_report.go

+ 44 - 5
logic/report/research_report.go

@@ -19,7 +19,8 @@ import (
 )
 
 type ResearchReportInfo struct {
-	ResearchReportInfo            *research_report.ResearchReport                     `json:"research_report_info"`
+	//ResearchReportInfo            *research_report.ResearchReport                     `json:"research_report_info"`
+	ResearchReportInfo            *ResearchReportShow                                 `json:"research_report_info"`
 	ResearchReportTypeList        []*company_report_permission.ResearchReportTypeList `json:"research_report_type_list"`
 	HasMenu                       int                                                 `json:"has_menu"`
 	ResearchReportTypeContentList []*research_report.ResearchReportTypeContent        `description:"报告详情"`
@@ -27,6 +28,25 @@ type ResearchReportInfo struct {
 	LikeEnabled                   int8                                                `description:"是否已点赞: 0-未点赞 1-已点赞" json:"like_enabled"`
 }
 
+type ResearchReportShow struct {
+	ResearchReportID    uint64 `json:"researchReportId"`    // 研究报告id
+	ResearchReportName  string `json:"researchReportName"`  // 研究报告名称
+	ResearchReportTitle string `json:"researchReportTitle"` // 研究报告标题
+	ResearchReportImg   string `json:"researchReportImg"`   // 报告缩略图URL
+	ResearchReportDate  string `json:"researchReportDate"`  // 报告日期
+	Type                string `json:"type"`                // day 晨报  week 周报 twoweek双周报 month 月报
+	Author              string `json:"author"`              // 报告作者
+	ReportVariety       string `json:"reportVariety"`       // 研究报告的品种,双周报和月报有标识
+	IsHasMenu           int8   `json:"isHasMenu"`           // 报告是否含有目录
+	IsSendedMsg         int8   `json:"isSendedMsg"`         // 是否发送过模板消息
+	Periods             int    `json:"periods"`             // 期数
+	Status              string `json:"status"`              // 状态,draft:草稿,
+	Enabled             int8   `json:"enabled"`             // 报告状态
+	CreatedTime         string `json:"createdTime"`         // 创建时间
+	LastUpdatedTime     string `json:"lastUpdatedTime"`     // 最后更新时间
+	Viewers             int    `json:"viewers"`             // H5观看用户数
+}
+
 // GetResearchReportInfo 获取报告详情
 func GetResearchReportInfo(researchReportId, userId uint64) (result ResearchReportInfo, hasPermission bool, err error) {
 	//获取报告详情
@@ -126,10 +146,29 @@ func GetResearchReportInfo(researchReportId, userId uint64) (result ResearchRepo
 	go PushViewRecordNewRedisData(userViewHistory, int(wxUserInfo.CompanyID))
 
 	//查询点赞数
-	likeNum,likeEnabled, _ := services.GetReportLikeByReportIdOldReportId(wxUserInfo.UserID, 0, 0, int(researchReportId),0)
+	likeNum, likeEnabled, _ := services.GetReportLikeByReportIdOldReportId(wxUserInfo.UserID, 0, 0, int(researchReportId), 0)
+
+	reportInfoShow := &ResearchReportShow{
+		ResearchReportID:    reportInfo.ResearchReportID,
+		ResearchReportName:  reportInfo.ResearchReportName,
+		ResearchReportTitle: reportInfo.ResearchReportTitle,
+		ResearchReportImg:   reportInfo.ResearchReportImg,
+		ResearchReportDate:  reportInfo.ResearchReportDate.Format(utils.FormatDate),
+		Type:                reportInfo.Type,
+		Author:              reportInfo.Author,
+		ReportVariety:       reportInfo.ReportVariety,
+		IsHasMenu:           reportInfo.IsHasMenu,
+		IsSendedMsg:         reportInfo.IsSendedMsg,
+		Periods:             reportInfo.Periods,
+		Status:              reportInfo.Status,
+		Enabled:             reportInfo.Enabled,
+		CreatedTime:         reportInfo.CreatedTime.Format(utils.FormatDateTime),
+		LastUpdatedTime:     reportInfo.LastUpdatedTime.Format(utils.FormatDateTime),
+		Viewers:             reportInfo.Viewers,
+	}
 
 	result = ResearchReportInfo{
-		ResearchReportInfo:     reportInfo,
+		ResearchReportInfo:     reportInfoShow,
 		ResearchReportTypeList: researchReportTypeList,
 		HasMenu:                1,
 		LikeNum:                likeNum,
@@ -137,7 +176,7 @@ func GetResearchReportInfo(researchReportId, userId uint64) (result ResearchRepo
 	}
 
 	if len(researchReportTypeList) <= 0 {
-		
+
 	} else if len(researchReportTypeList) == 1 {
 		//只有一个章节,即没有目录的时候,需要直接返回章节详情
 		result.HasMenu = 0
@@ -258,7 +297,7 @@ func GetResearchReportTypeContentInfo(researchReportTypeId, userId uint64) (resu
 	go PushViewRecordNewRedisData(userViewHistory, int(wxUserInfo.CompanyID))
 
 	//查询点赞数
-	likeNum,likeEnabled, _ := services.GetReportLikeByReportIdOldReportId(wxUserInfo.UserID, 0, 0, int(researchReportTypeInfo.ResearchReportID), int(researchReportTypeInfo.ResearchReportTypeID))
+	likeNum, likeEnabled, _ := services.GetReportLikeByReportIdOldReportId(wxUserInfo.UserID, 0, 0, int(researchReportTypeInfo.ResearchReportID), int(researchReportTypeInfo.ResearchReportTypeID))
 	result = ResearchReportTypeContentInfo{
 		ResearchReportTypeContentList: researchReportTypeContentList,
 		ResearchReportTypeInfo:        researchReportTypeInfo,