Эх сурвалжийг харах

Merge branch 'master' into yb/4.0

# Conflicts:
#	models/response/report.go
xiexiaoyuan 2 жил өмнө
parent
commit
4cc3038c23

+ 23 - 22
controller/chart/chart_info.go

@@ -37,7 +37,7 @@ import (
 // @Success 200 {object} chart_info.ChartInfoDetailResp
 // @failure 400 {string} string "图表详情获取失败"
 // @Router /my_chart/getChartInfoDetail [get]
-func GetChartInfoDetail(c *gin.Context)  {
+func GetChartInfoDetail(c *gin.Context) {
 	// 图表ID
 	reqChartInfoId := c.DefaultQuery("ChartInfoId", "")
 	if reqChartInfoId == "" {
@@ -68,7 +68,7 @@ func GetChartInfoDetail(c *gin.Context)  {
 			response.Fail("图表不存在,请刷新页面", c)
 			return
 		}
-		response.FailMsg("获取失败", "获取图表信息失败, Err:" + err.Error(), c)
+		response.FailMsg("获取失败", "获取图表信息失败, Err:"+err.Error(), c)
 		return
 	}
 	chartType = chartInfo.ChartType
@@ -84,7 +84,7 @@ func GetChartInfoDetail(c *gin.Context)  {
 		dateType, _ = strconv.Atoi(reqDateType)
 	}
 	if dateType <= 0 {
-		dateType = 3	// 默认同后台15年至今
+		dateType = 3 // 默认同后台15年至今
 	}
 
 	switch dateType {
@@ -149,14 +149,14 @@ func GetChartInfoDetail(c *gin.Context)  {
 	if chartInfoId > 0 {
 		mappingList, err = chartEdbMappingModel.GetMappingListByChartInfoId(chartInfoId)
 		if err != nil {
-			response.FailMsg("获取失败", "获取图表指标信息失败4001, Err:" + err.Error(), c)
+			response.FailMsg("获取失败", "获取图表指标信息失败4001, Err:"+err.Error(), c)
 			return
 		}
 	} else {
 		if edbInfoId != "" {
 			mappingList, err = chartEdbMappingModel.GetMappingListByEdbInfoId(edbInfoId)
 			if err != nil {
-				response.FailMsg("获取失败", "获取图表指标信息失败4002, Err:" + err.Error(), c)
+				response.FailMsg("获取失败", "获取图表指标信息失败4002, Err:"+err.Error(), c)
 				return
 			}
 		}
@@ -210,10 +210,13 @@ func GetChartInfoDetail(c *gin.Context)  {
 		item.LatestValue = v.LatestValue
 		item.LatestDate = v.LatestDate
 		item.UniqueCode = v.UniqueCode
+		item.ChartStyle = v.ChartStyle
 
 		var startDateReal string
 		var diffSeconds int64
-		if chartType == 1 {
+		if chartType == 2 { //季节性图表
+			startDateReal = startDate
+		} else {
 			if v.EdbInfoType == 0 && v.LeadUnit != "" && v.LeadValue > 0 {
 				// 领先指标
 				var startTimeRealTemp time.Time
@@ -240,15 +243,13 @@ func GetChartInfoDetail(c *gin.Context)  {
 			} else {
 				startDateReal = startDate
 			}
-		} else {
-			startDateReal = startDate
 		}
 		//fmt.Println("line 1011 chart:", v.Source, v.EdbInfoId, startDateReal, endDate)
 		calendarPreYear := 0
 		if calendar == "农历" {
 			newStartDateReal, err := time.Parse(utils.FormatDate, startDateReal)
 			if err != nil {
-				response.FailMsg("获取失败", "农历时间转换有误4001, Err:" + err.Error(), c)
+				response.FailMsg("获取失败", "农历时间转换有误4001, Err:"+err.Error(), c)
 				//fmt.Println("time.Parse:" + err.Error())
 				return
 			}
@@ -260,7 +261,7 @@ func GetChartInfoDetail(c *gin.Context)  {
 		fmt.Println("chart:", v.Source, v.EdbInfoId, startDateReal, endDate)
 		dataList, err = edbDataModel.GetEdbDataList(v.Source, v.EdbInfoId, startDateReal, endDate)
 		if err != nil {
-			response.FailMsg("获取失败", "获取图表指标信息失败4003, Err:" + err.Error(), c)
+			response.FailMsg("获取失败", "获取图表指标信息失败4003, Err:"+err.Error(), c)
 			return
 		}
 		if diffSeconds != 0 && v.EdbInfoType == 0 {
@@ -278,7 +279,7 @@ func GetChartInfoDetail(c *gin.Context)  {
 				} else {
 					result, err := edbDataService.AddCalculateQuarter(dataList)
 					if err != nil {
-						response.FailMsg("获取失败", "获取农历数据失败4002, Err:" + err.Error(), c)
+						response.FailMsg("获取失败", "获取农历数据失败4002, Err:"+err.Error(), c)
 						return
 					}
 					if result.List[0].Year != calendarPreYear {
@@ -304,7 +305,7 @@ func GetChartInfoDetail(c *gin.Context)  {
 				for _, v := range dataList {
 					itemDate, err := time.Parse(utils.FormatDate, v.DataTime)
 					if err != nil {
-						response.FailMsg("获取失败", "季度指标日期转换失败, Err:" + err.Error() + ";DataTime:" + v.DataTime, c)
+						response.FailMsg("获取失败", "季度指标日期转换失败, Err:"+err.Error()+";DataTime:"+v.DataTime, c)
 						return
 					}
 					year := itemDate.Year()
@@ -364,7 +365,7 @@ func GetChartInfoDetail(c *gin.Context)  {
 // @Success 200 {string} string "操作成功"
 // @failure 400 {string} string "操作失败"
 // @Router /my_chart/refreshChartInfo [post]
-func RefreshChartInfo(c *gin.Context)  {
+func RefreshChartInfo(c *gin.Context) {
 	// 参数校验
 	var req chartInfoModel.RefreshChartInfoReq
 	if c.ShouldBind(&req) != nil {
@@ -380,7 +381,7 @@ func RefreshChartInfo(c *gin.Context)  {
 	userInfo := user.GetInfoByClaims(c)
 	ok, _, err := user.GetAdminByUserInfo(userInfo)
 	if err != nil {
-		response.FailMsg("刷新失败", "RefreshChartInfo-获取系统用户信息失败" + err.Error(), c)
+		response.FailMsg("刷新失败", "RefreshChartInfo-获取系统用户信息失败"+err.Error(), c)
 		return
 	}
 	if !ok {
@@ -406,7 +407,7 @@ func RefreshChartInfo(c *gin.Context)  {
 			response.Fail("图表已被删除,无需刷新", c)
 			return
 		}
-		response.FailMsg("刷新失败", "刷新失败, Err:" + err.Error(), c)
+		response.FailMsg("刷新失败", "刷新失败, Err:"+err.Error(), c)
 		return
 	}
 
@@ -442,7 +443,7 @@ func RefreshChartInfo(c *gin.Context)  {
 // @Success 200 {string} string "操作成功"
 // @failure 400 {string} string "操作失败"
 // @Router /my_chart/editChartInfo [post]
-func EditChartInfo(c *gin.Context)  {
+func EditChartInfo(c *gin.Context) {
 	// 参数校验
 	var req chartInfoModel.SaveChartInfoReq
 	if c.ShouldBind(&req) != nil {
@@ -474,7 +475,7 @@ func EditChartInfo(c *gin.Context)  {
 			response.Fail("图表已被删除,请刷新页面!", c)
 			return
 		}
-		response.FailMsg("操作失败", "获取图表信息失败, Err:" + err.Error(), c)
+		response.FailMsg("操作失败", "获取图表信息失败, Err:"+err.Error(), c)
 		return
 	}
 	if chartItem.ChartType == 2 && len(req.ChartEdbInfoList) > 1 {
@@ -493,14 +494,14 @@ func EditChartInfo(c *gin.Context)  {
 		edbInfo, err := edbInfoModel.GetEdbInfoById(v.EdbInfoId)
 		if err != nil {
 			if err == utils.ErrNoRow {
-				response.FailMsg("操作失败", "图表不存在,ChartInfoId:" + strconv.Itoa(v.EdbInfoId), c)
+				response.FailMsg("操作失败", "图表不存在,ChartInfoId:"+strconv.Itoa(v.EdbInfoId), c)
 				return
 			}
-			response.FailMsg("操作失败", "获取图表的指标信息失败,Err:" + err.Error(), c)
+			response.FailMsg("操作失败", "获取图表的指标信息失败,Err:"+err.Error(), c)
 			return
 		}
 		if edbInfo == nil {
-			response.FailMsg("操作失败", "指标不存在,ChartInfoId:" + strconv.Itoa(v.EdbInfoId), c)
+			response.FailMsg("操作失败", "指标不存在,ChartInfoId:"+strconv.Itoa(v.EdbInfoId), c)
 			return
 		}
 		edbInfoIdArr = append(edbInfoIdArr, v.EdbInfoId)
@@ -516,7 +517,7 @@ func EditChartInfo(c *gin.Context)  {
 
 	err = chart.ModifyChartInfoAndMapping(edbInfoIdStr, &req, chartItem.ChartType)
 	if err != nil {
-		response.Fail("图表保存失败, Err:" + err.Error(), c)
+		response.Fail("图表保存失败, Err:"+err.Error(), c)
 		return
 	}
 
@@ -542,4 +543,4 @@ func EditChartInfo(c *gin.Context)  {
 	}
 
 	response.OkData("操作成功", "", c)
-}
+}

+ 16 - 13
logic/public.go

@@ -10,23 +10,26 @@ type ApplyVariety struct {
 func GetApplyVarietyList() (list []ApplyVariety) {
 	list = append(list, ApplyVariety{PermissionName: "宏观经济", Name: "宏观经济", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/宏观经济.png"})
 	list = append(list, ApplyVariety{PermissionName: "利率债", Name: "利率债", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/利率债.png"})
+	list = append(list, ApplyVariety{PermissionName: "原油", Name: "原油", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/原油.png"})
+	list = append(list, ApplyVariety{PermissionName: "PTA", Name: "PTA", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/PTA.png"})
+	list = append(list, ApplyVariety{PermissionName: "MEG", Name: "MEG", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/MEG.png"})
+	list = append(list, ApplyVariety{PermissionName: "织造终端", Name: "织造终端", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/织造终端.png"})
+	list = append(list, ApplyVariety{PermissionName: "甲醇", Name: "甲醇", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/甲醇.png"})
+	list = append(list, ApplyVariety{PermissionName: "聚烯烃", Name: "聚烯烃", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/聚烯烃.png"})
+	list = append(list, ApplyVariety{PermissionName: "沥青", Name: "沥青", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/沥青.png"})
+	list = append(list, ApplyVariety{PermissionName: "纯苯+苯乙烯", Name: "纯苯+苯乙烯", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/苯乙烯.png"})
+	list = append(list, ApplyVariety{PermissionName: "PVC", Name: "PVC", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/PVC.png"})
+	list = append(list, ApplyVariety{PermissionName: "聚酯", Name: "聚酯", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/聚酯.png"})
 	list = append(list, ApplyVariety{PermissionName: "钢材", Name: "钢材", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/钢材.png"})
 	list = append(list, ApplyVariety{PermissionName: "铁矿", Name: "铁矿", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/铁矿.png"})
+	list = append(list, ApplyVariety{PermissionName: "玻璃纯碱", Name: "玻璃纯碱", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/玻璃纯碱.png"})
 	list = append(list, ApplyVariety{PermissionName: "双焦(焦煤、焦炭)", Name: "双焦(焦煤、焦炭)", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/双焦(焦煤、焦炭).png"})
-	list = append(list, ApplyVariety{PermissionName: "有色(锌、铅)", Name: "有色(锌、铅)", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/有色(锌、铅).png"})
 	list = append(list, ApplyVariety{PermissionName: "有色(铜、铝)", Name: "有色(铜、铝)", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/有色(铜、铝).png"})
 	list = append(list, ApplyVariety{PermissionName: "镍+不锈钢", Name: "镍+不锈钢", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/镍2不锈钢.png"})
-	list = append(list, ApplyVariety{PermissionName: "原油", Name: "原油", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/原油.png"})
-	list = append(list, ApplyVariety{PermissionName: "聚烯烃", Name: "聚烯烃", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/聚烯烃.png"})
-	list = append(list, ApplyVariety{PermissionName: "苯乙烯", Name: "苯乙烯", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/苯乙烯.png"})
-	list = append(list, ApplyVariety{PermissionName: "甲醇", Name: "甲醇", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/甲醇.png"})
-	list = append(list, ApplyVariety{PermissionName: "玻璃纯碱", Name: "玻璃纯碱", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/玻璃纯碱.png"})
-	list = append(list, ApplyVariety{PermissionName: "橡胶", Name: "橡胶", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/橡胶.png"})
-	//list = append(list, ApplyVariety{PermissionName: "聚酯", Name: "聚酯", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/聚酯.png"})
-	list = append(list, ApplyVariety{PermissionName: "PTA", Name: "PTA", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/PTA.png"})
-	list = append(list, ApplyVariety{PermissionName: "MEG", Name: "MEG", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/MEG.png"})
-	list = append(list, ApplyVariety{PermissionName: "沥青", Name: "沥青", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/沥青.png"})
-	list = append(list, ApplyVariety{PermissionName: "织造终端", Name: "织造终端", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/织造终端.png"})
-	list = append(list, ApplyVariety{PermissionName: "策略", Name: "市场策略", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/市场策略.png"})
+	list = append(list, ApplyVariety{PermissionName: "有色(锌)", Name: "有色(锌)", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/有色锌.png"})
+	list = append(list, ApplyVariety{PermissionName: "钴锂", Name: "钴锂", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/钴锂.png"})
+	//list = append(list, ApplyVariety{PermissionName: "苯乙烯", Name: "苯乙烯", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/苯乙烯.png"})
+	//list = append(list, ApplyVariety{PermissionName: "橡胶", Name: "橡胶", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/橡胶.png"})
+	//list = append(list, ApplyVariety{PermissionName: "策略", Name: "市场策略", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/市场策略.png"})
 	return
 }

+ 1 - 1
models/response/classify.go

@@ -23,7 +23,7 @@ type ClassifyDetail struct {
 	Descript        string               `json:"descript"`
 	PermissionCheck *PermissionCheckInfo `json:"permission_check"`
 	AuthOk          bool                 `json:"auth_ok"`
-	VipTitle        string               `json:"vip_title"'`
+	VipTitle        string               `json:"vip_title"`
 }
 
 type ClassReportListItem struct {

+ 111 - 107
models/response/report.go

@@ -5,139 +5,142 @@ 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"`
+	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"`
 }
 
 type ReportChapterListItem struct {
-	ReportChapterId    int    `json:"report_chapter_id"`
-	ReportId        int    `json:"report_id"`
-	Title           string    `json:"title"`
-	TypeId                  int         `json:"type_id"`
-	TypeName                string         	`json:"type_name"`
-	Trend                   string      `json:"trend"`
-	ReportChapterTypeKey    string      `json:"report_chapter_type_key"`
-	ReportChapterTypeThumb  string	    `json:"report_chapter_type_thumb"`
-	ReportChapterTypeName   string       `json:"report_chapter_type_name"`
-	Sort                    int          `json:"sort"`
-	PublishTime         time.Time    `json:"publish_time"`
+	ReportChapterId        int       `json:"report_chapter_id"`
+	ReportId               int       `json:"report_id"`
+	Title                  string    `json:"title"`
+	TypeId                 int       `json:"type_id"`
+	TypeName               string    `json:"type_name"`
+	Trend                  string    `json:"trend"`
+	ReportChapterTypeKey   string    `json:"report_chapter_type_key"`
+	ReportChapterTypeThumb string    `json:"report_chapter_type_thumb"`
+	ReportChapterTypeName  string    `json:"report_chapter_type_name"`
+	Sort                   int       `json:"sort"`
+	PublishTime            time.Time `json:"publish_time"`
 }
 
 type ReportItem struct {
-	ReportId           int    `json:"report_id"`
-	ClassifyNameFirst  string `description:"一级分类名称" json:"classify_name_first"`
-	ClassifyNameSecond string `description:"二级分类名称" json:"classify_name_second"`
-	Title              string `description:"标题" json:"title"`
-	Abstract           string `description:"摘要" json:"abstract"`
-	Author             string `description:"作者" json:"author"`
-	Frequency          string `description:"频度" json:"frequency"`
+	ReportId           int       `json:"report_id"`
+	ClassifyNameFirst  string    `description:"一级分类名称" json:"classify_name_first"`
+	ClassifyNameSecond string    `description:"二级分类名称" json:"classify_name_second"`
+	Title              string    `description:"标题" json:"title"`
+	Abstract           string    `description:"摘要" json:"abstract"`
+	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"`
-	VideoPlaySeconds   string `description:"音频播放时长" json:"video_play_seconds"`
-	ContentSub         string `description:"内容前两个章节" json:"content_sub"`
-	BannerUrl          string `description:"详情页banner" json:"banner_url"`
+	Stage              int       `description:"期数" json:"stage"`
+	Content            string    `description:"内容" json:"content"`
+	VideoUrl           string    `description:"音频文件URL" json:"video_url"`
+	VideoName          string    `description:"音频文件名称" json:"video_name"`
+	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"`
 }
 
 type ReportChapterItem struct {
-	ReportChapterId    int    `json:"report_chapter_id"`
-	ReportId        int    `json:"report_id"`
-	Title           string    `json:"title"`
-	TypeId                  int         `json:"type_id"`
-	TypeName                string         	`json:"type_name"`
-	Trend                   string      `json:"trend"`
-	ReportChapterTypeName   string       `json:"report_chapter_type_name"`
-	PublishTime         time.Time    `json:"publish_time"`
-	Content            string `description:"内容" json:"content"`
-	ContentSub         string `description:"内容前两个章节" json:"content_sub"`
-	VideoUrl            string    `json:"video_url"`                    //音频文件URL
-	VideoName           string    `json:"video_name"`                  //音频文件名称
-	VideoPlaySeconds    string    `json:"video_play_seconds"`      //音频播放时长
-	VideoSize           string    `json:"video_size"`
-	Author              string    `description:"作者" json:"author"`
-	Stage              int        `description:"期数" json:"stage"`
-	ClassifyIdFirst    int        `description:"一级分类id" json:"classify_id_first"`
-	ClassifyNameFirst  string     `description:"一级分类名称" json:"classify_name_first"`
+	ReportChapterId       int       `json:"report_chapter_id"`
+	ReportId              int       `json:"report_id"`
+	Title                 string    `json:"title"`
+	TypeId                int       `json:"type_id"`
+	TypeName              string    `json:"type_name"`
+	Trend                 string    `json:"trend"`
+	ReportChapterTypeName string    `json:"report_chapter_type_name"`
+	PublishTime           time.Time `json:"publish_time"`
+	Content               string    `description:"内容" json:"content"`
+	ContentSub            string    `description:"内容前两个章节" json:"content_sub"`
+	VideoUrl              string    `json:"video_url"`          //音频文件URL
+	VideoName             string    `json:"video_name"`         //音频文件名称
+	VideoPlaySeconds      string    `json:"video_play_seconds"` //音频播放时长
+	VideoSize             string    `json:"video_size"`
+	VideoImg              string    `description:"音频播放条的图片" json:"video_img"`
+	Author                string    `description:"作者" json:"author"`
+	Stage                 int       `description:"期数" json:"stage"`
+	ClassifyIdFirst       int       `description:"一级分类id" json:"classify_id_first"`
+	ClassifyNameFirst     string    `description:"一级分类名称" json:"classify_name_first"`
 }
 
 type ReportChapterDetail struct {
-	ReportChapterItem  * ReportChapterItem  `json:"report_chapter_item"`
-	PermissionCheck     *PermissionCheckInfo    `json:"permission_check"`
-	ReportChapterMenuList        []*ReportChapterMenu `json:"report_chapter_menu_list"`
-	AuthOk              bool `json:"auth_ok"`
-	LikeNum             int64  `description:"点赞总数" json:"like_num"`
-	LikeEnabled         int8 `description:"是否已点赞: 0-未点赞 1-已点赞" json:"like_enabled"`
+	ReportChapterItem      *ReportChapterItem      `json:"report_chapter_item"`
+	PermissionCheck        *PermissionCheckInfo    `json:"permission_check"`
+	ReportChapterMenuList  []*ReportChapterMenu    `json:"report_chapter_menu_list"`
+	AuthOk                 bool                    `json:"auth_ok"`
+	LikeNum                int64  `description:"点赞总数" json:"like_num"`
+	LikeEnabled            int8 `description:"是否已点赞: 0-未点赞 1-已点赞" json:"like_enabled"`
 }
 
 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"`
-	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"`
+	Sort                   int    `json:"sort"`
 }
 
 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"`
-	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"`
+	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"`
+	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"`
+	AuthOk             bool             `json:"auth_ok"`
+	TitleInfo          string           `json:"title_info"`
 }
 
 type VideoListItem struct {
-	VideoUrl            string `description:"音频文件URL" json:"video_url"`
-	Sort                int `description:"音频内容排序" json:"sort"`
-	VideoName           string    `json:"video_name"`               //音频文件名称
-	VideoPlaySeconds    string    `json:"video_play_seconds"`      //音频播放时长
+	VideoUrl         string `description:"音频文件URL" json:"video_url"`
+	Sort             int    `description:"音频内容排序" json:"sort"`
+	VideoName        string `json:"video_name"`         //音频文件名称
+	VideoPlaySeconds string `json:"video_play_seconds"` //音频播放时长
+	VideoImg         string `json:"video_img"`          // 音频播放条前面展示的图片
 }
 
 type ReportList struct {
-	Paging     *PagingItem  		`json:"paging"`
-	List        []*ReportListItem `json:"list"`
+	Paging *PagingItem       `json:"paging"`
+	List   []*ReportListItem `json:"list"`
 }
 
 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"`
+	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"`
 }
 
 type ReportCollectList struct {
-	Date     string   	`json:"date"`
-	SubList  []*ReportCollectListItem `json:"sub_list"`
+	Date    string                   `json:"date"`
+	SubList []*ReportCollectListItem `json:"sub_list"`
 }
 
 type ReportCollectResp struct {
-	Paging     *PagingItem  		`json:"paging"`
-	List []*ReportCollectList `json:"list"`
+	Paging *PagingItem          `json:"paging"`
+	List   []*ReportCollectList `json:"list"`
 }
 
 type ReportSearchResp struct {
-	Paging     *PagingItem  		`json:"paging"`
-	List []*ReportCollectListItem `json:"list"`
+	Paging *PagingItem              `json:"paging"`
+	List   []*ReportCollectListItem `json:"list"`
 }
 
 type EsReportItem struct {
@@ -158,24 +161,24 @@ type EsReportItem struct {
 }
 
 type TickerDataItem struct {
-	Date             string        `json:"date"`
-	Ticker			 string        `json:"ticker"`
-	BaseColumnName   string        `json:"base_column_name"`
-	TickerValue      float64       `json:"ticker_value"`
-	LastValue        float64       `json:"last_value"`
-	DdValue          float64       `json:"dd_value"`
-	WwValue          float64       `json:"ww_value"`
-	MmValue          float64       `json:"mm_value"`
+	Date           string  `json:"date"`
+	Ticker         string  `json:"ticker"`
+	BaseColumnName string  `json:"base_column_name"`
+	TickerValue    float64 `json:"ticker_value"`
+	LastValue      float64 `json:"last_value"`
+	DdValue        float64 `json:"dd_value"`
+	WwValue        float64 `json:"ww_value"`
+	MmValue        float64 `json:"mm_value"`
 }
 type TickerTitleData struct {
-	TickerTitle      string      `json:"ticker_title"`
-	ReportChapterTypeId  int     `json:"report_chapter_type_id"`
+	TickerTitle           string `json:"ticker_title"`
+	ReportChapterTypeId   int    `json:"report_chapter_type_id"`
 	ReportChapterTypeName string `json:"report_chapter_type_name"`
-	DataTableImage string   `json:"data_table_image"`
+	DataTableImage        string `json:"data_table_image"`
 }
 type TickerData struct {
-	List []*TickerDataItem `json:"list"`
-	TickerTitle *TickerTitleData `json:"ticker_title"`
+	List        []*TickerDataItem `json:"list"`
+	TickerTitle *TickerTitleData  `json:"ticker_title"`
 }
 
 type ReportCollectListResp []*ReportCollectList
@@ -193,6 +196,7 @@ func (p ReportCollectListResp) Swap(i, j int) {
 }
 
 type ReportChapterList []*ReportChapterListItem
+
 func (r ReportChapterList) Len() int {
 	return len(r)
 }
@@ -217,4 +221,4 @@ func (rc ReportChapterMenuList) Less(i, j int) bool {
 
 func (rc ReportChapterMenuList) Swap(i, j int) {
 	rc[i], rc[j] = rc[j], rc[i]
-}
+}

+ 1 - 1
models/tables/rddp/classify/query.go

@@ -58,7 +58,7 @@ func GetByClassifyId(id int) (item *Classify, err error) {
 // GetListByPid 根据分类名称查找专栏列表
 func GetListByPid(pid int) (list []*Classify, err error) {
 	err = global.MYSQL["rddp"].Model(Classify{}).
-		Select("id, classify_name, parent_id, report_author, author_descript, home_img_url, vip_title").
+		Select("id, classify_name, parent_id, report_author, author_descript, home_img_url, vip_title, avatar_img_url").
 		Where("parent_id = ? AND is_show = 1 ", pid).Order("sort asc, id asc").Scan(&list).Error
 	if err == utils.ErrNoRow {
 		err = nil

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

@@ -58,7 +58,7 @@ func GetListByReportIdTypeIds(reportId int, typeIds []int, classifyNameFirst str
 
 // GetContentById 根据ID获取章节详情
 func GetContentById(id int, typeIds []int) (info *ReportChapter, err error)  {
-	err = global.MYSQL["rddp"].Model(ReportChapter{}).Select("report_chapter_id, report_id,  is_edit, classify_name_first, classify_id_first, content, trend, type_id, type_name, abstract, title, author, stage, publish_time, content, content_sub, video_url, video_name, video_play_seconds, video_size").
+	err = global.MYSQL["rddp"].Model(ReportChapter{}).Select("report_chapter_id, report_id,  is_edit, classify_name_first, classify_id_first, content, trend, type_id, type_name, abstract, title, author, stage, publish_time, content, content_sub, video_url, video_name, video_play_seconds, video_size, report_type").
 		Where("report_chapter_id = ? and type_id in (?) AND publish_state = 2 ", id, typeIds).
 		First(&info).Error
 	if err == utils.ErrNoRow {

+ 2 - 2
services/report/classify.go

@@ -71,7 +71,7 @@ func GetClassListByClassifyId(user user.UserInfo, classifyIdFirst int) (list []*
 		temp.ParentId = item.ParentId
 		temp.AuthorDescript = item.AuthorDescript
 		temp.ReportAuthor = item.ReportAuthor
-		temp.HomeImgUrl = item.HomeImgUrl
+		temp.HomeImgUrl = item.AvatarImgUrl	// 此处图片用二级分类的"头像"
 		temp.ClassifyNameSecond = item.ClassifyName
 		temp.VipTitle = item.VipTitle
 		if classifyInfo.ClassifyName == "权益研报" {
@@ -232,7 +232,7 @@ func GetClassifyReportList(user user.UserInfo, classifyIdSecond int, pageIndex,
 				reportItem.Abstract = "<div style=\"overflow: hidden;white-space: nowrap;text-overflow: ellipsis;\">" +reportInfo.Abstract+"</div>"
 			}
 			reportItem.Author = reportInfo.Author
-			reportItem.ReportImgUrl = classifyInfo.ReportImgUrl
+			reportItem.ReportImgUrl = classifyInfo.AvatarImgUrl	// 此处图片用二级分类的"头像"
 			reportItem.VideoName = reportInfo.VideoName
 			reportItem.VideoPlaySeconds = reportInfo.VideoPlaySeconds
 			if  reportInfo.VideoUrl != "" && reportInfo.VideoName == "" {

+ 31 - 0
services/report/report.go

@@ -442,6 +442,30 @@ func GetReportDetail(userinfo user.UserInfo, reportId int) (reportDetail respons
 				return
 			}
 		}
+	} else {
+		// 音频播放条图片用分类图片
+		reportItem.VideoImg = utils.HZ_DEFAULT_AVATAR
+		permissionIds, tmpErr := chart_permission_search_key_word_mapping.GetChartPermissionIdsByKeyWord(reportItem.ClassifyNameSecond)
+		if tmpErr != nil {
+			errMsg = tmpErr.Error()
+			err = errors.New("查询报告权限失败")
+			return
+		}
+		if len(permissionIds) > 0 {
+			chartPermission, tmpErr := chart_permission.GetListByIds(permissionIds)
+			if tmpErr != nil {
+				errMsg = tmpErr.Error()
+				err = errors.New("查询品种信息失败")
+				return
+			}
+			lenChart := len(chartPermission)
+			for i := 0; i < lenChart; i++ {
+				if chartPermission[i].YbImgUrl != "" {
+					reportItem.VideoImg = utils.ALIYUN_YBIMG_HOST + chartPermission[i].YbImgUrl
+					break
+				}
+			}
+		}
 	}
 	//如果有权限则展示content
 	var likeNum int64
@@ -795,6 +819,9 @@ func GetReportList(user user.UserInfo, keyWord string, classifyIdFirst, classify
 			if classifyParent.ClassifyName == "晨报" && productAuthOk {
 				// 查询当前晨报的所有音频
 				if vList, ok := videoMap[reportInfo.Id]; ok {
+					for _,vd := range vList {
+						vd.VideoImg = reportItem.ReportImgUrl
+					}
 					reportItem.VideoList = vList
 				}
 				reportItem.AuthOk = productAuthOk
@@ -804,6 +831,9 @@ func GetReportList(user user.UserInfo, keyWord string, classifyIdFirst, classify
 					if wAuth {
 						// 查询当前晨报的所有音频
 						if vList, ok2 := videoMap[reportInfo.Id]; ok2 {
+							for _,vd := range vList {
+								vd.VideoImg = reportItem.ReportImgUrl
+							}
 							reportItem.VideoList = vList
 						}
 					}
@@ -817,6 +847,7 @@ func GetReportList(user user.UserInfo, keyWord string, classifyIdFirst, classify
 						videoTemp.VideoName = reportInfo.Title
 					}
 					videoTemp.VideoPlaySeconds = reportInfo.VideoPlaySeconds
+					videoTemp.VideoImg = reportItem.ReportImgUrl
 					reportItem.VideoList = append(reportItem.VideoList, videoTemp)
 				}
 				reportItem.AuthOk = authOk

+ 7 - 2
services/report/report_chapter.go

@@ -198,7 +198,7 @@ func GetChapterDetail(user user.UserInfo, reportChapterId int) (reportChapterDet
 
 	reportInfo, tErr := report.GetByReportId(reportChapter.ReportId)
 	if tErr != nil {
-		errMsg = err.Error()
+		errMsg = tErr.Error()
 		err = errors.New("报告查询出错")
 		return
 	}
@@ -210,7 +210,7 @@ func GetChapterDetail(user user.UserInfo, reportChapterId int) (reportChapterDet
 		err = errors.New("章节未编辑")
 		return
 	}
-	//判断权限 TODO 查询章节相关的报告的charPermissionId
+	//判断权限
 	var newTypeIds []int
 	if reportInfo.ClassifyNameFirst == "晨报"{
 		authOk, permissionCheckInfo, err = CheckDayReportPermission(user, productAuthOk)
@@ -249,6 +249,11 @@ func GetChapterDetail(user user.UserInfo, reportChapterId int) (reportChapterDet
 		reportChapterItem.VideoName = reportChapter.Title
 	}
 	reportChapterItem.VideoSize = reportChapter.VideoSize
+	videoImgMap := map[string]string{
+		"day": "report_list_chen.png",
+		"week": "report_list_zhou.png",
+	}
+	reportChapterItem.VideoImg = utils.ALIYUN_YBIMG_HOST + videoImgMap[reportChapter.ReportType]
 	reportChapterItem.TypeName = reportChapter.TypeName
 	reportChapterItem.Author = reportChapter.Author
 	reportChapterItem.Stage = reportChapter.Stage

+ 7 - 1
services/share_poster.go

@@ -35,7 +35,13 @@ func CreatePosterFromSource(codePage, codeScene, source, version, pars string) (
 	defer func() {
 		if err != nil {
 			global.LOG.Critical(fmt.Sprintf("CreatePosterFromSource: source=%s, pars:%s, errMsg:%s", source, pars, errMsg))
-			go alarm_msg.SendAlarmMsg("CreatePosterFromSource生成分享海报失败, Msg:"+errMsg+";Err:"+err.Error(), 2)
+			reqSlice := make([]string, 0)
+			reqSlice = append(reqSlice, fmt.Sprint("CodePage:", codePage, "\n"))
+			reqSlice = append(reqSlice, fmt.Sprint("CodeScene:", codeScene, "\n"))
+			reqSlice = append(reqSlice, fmt.Sprint("Source:", source, "\n"))
+			reqSlice = append(reqSlice, fmt.Sprint("Version:", version, "\n"))
+			reqSlice = append(reqSlice, fmt.Sprint("Pars:", pars, "\n"))
+			go alarm_msg.SendAlarmMsg("CreatePosterFromSource生成分享海报失败, Msg:"+errMsg+";Err:"+err.Error()+"\n;Req:\n"+strings.Join(reqSlice, ";"), 3)
 		}
 	}()
 	if codePage == "" || source == "" || pars == "" {

+ 6 - 5
services/wx_app/wx_app.go

@@ -27,10 +27,6 @@ func init() {
 	WxId = `gh_75abb562a946`
 	WxAppSecret = `1737c73e9f69a21de1a345b8f0800258`
 	WxPlatform = 6 //弘则研报来源
-	EnvVersion = "trial"
-	if global.CONFIG.Serve.RunMode == "release" {
-		EnvVersion = "release"
-	}
 }
 
 func GetWxApp() (miniprogram *miniprogram.MiniProgram) {
@@ -74,10 +70,15 @@ func GetDecryptInfo(sessionKey, encryptedData, iv string) (decryptData *encrypto
 
 // GetSunCode 获取太阳码
 func GetSunCode(page, scene string) (resp []byte, err error) {
+	// 此处因初始化顺序问题不放在init中
+	env := "trial"
+	if global.CONFIG.Serve.RunMode == "release" {
+		env = "release"
+	}
 	codePars := qrcode.QRCoder{
 		Page:       page,
 		Scene:      scene,
-		EnvVersion: EnvVersion,
+		EnvVersion: env,
 	}
 	wechatClient := GetWxApp()
 	qr := wechatClient.GetQRCode()

+ 1 - 0
utils/constants.go

@@ -119,6 +119,7 @@ var (
 )
 
 const ALIYUN_YBIMG_HOST = "https://hzstatic.hzinsights.com/static/yb_wx/"
+const HZ_DEFAULT_AVATAR = "https://hzstatic.hzinsights.com/static/yb_wx/hz_default_avatar.png"
 
 const HZPHONE = "057187186319"    //弘则电话