package controllers import ( "hongze/hongze_api/models" "html" ) // ReportShareController 报告分享 type ReportShareController struct { BaseCommonController } // Detail // @Title 日评详情 // @Description 日评详情接口 // @Param ReportCode query string true "报告唯一编码" // @Success 200 {object} models.ReportShareDetailResp // @router /share/detail [get] func (this *ReportShareController) Detail() { br := new(models.BaseResponse).Init() defer func() { this.Data["json"] = br this.ServeJSON() }() reportCode := this.GetString("ReportCode") if reportCode == "" { br.Msg = "参数错误" br.ErrMsg = "参数错误,reportCode 为空" return } report, err := models.GetReportByCode(reportCode) if err != nil { br.Msg = "该报告已删除" br.ErrMsg = "获取报告详情失败,Err:" + err.Error() return } report.ContentSub = html.UnescapeString(report.ContentSub) report.Content = html.UnescapeString(report.Content) resp := new(models.ReportShareDetailResp) // 免责声明 conf, e := models.GetBusinessConf() if e != nil { br.Msg = "获取失败" br.ErrMsg = "获取免责声明失败, Err: " + e.Error() return } if conf[models.BusinessConfDisclaimer] != "" { resp.Disclaimer = conf[models.BusinessConfDisclaimer] } // 研报分享抬头 if v, ok := conf[models.BusinessConfH5ShareName]; ok { resp.H5ShareName = v } if v, ok := conf[models.BusinessConfH5ReportShareImg]; ok { resp.H5ReportShareImg = v } resp.Hz = 1 resp.Report = report br.Ret = 200 br.Success = true br.Msg = "获取成功" br.Data = resp } // TrialDetail // @Title 日评详情-ETA试用平台 // @Description 日评详情接口 // @Param ReportCode query string true "报告唯一编码" // @Success 200 {object} models.ReportShareDetailResp // @router /trial/share/detail [get] func (this *ReportShareController) TrialDetail() { br := new(models.BaseResponse).Init() defer func() { this.Data["json"] = br this.ServeJSON() }() reportCode := this.GetString("ReportCode") if reportCode == "" { br.Msg = "参数错误" br.ErrMsg = "参数错误,reportCode 为空" return } report, err := models.GetTrialReportByCode(reportCode) if err != nil { br.Msg = "该报告已删除" br.ErrMsg = "获取报告详情失败,Err:" + err.Error() return } report.ContentSub = html.UnescapeString(report.ContentSub) report.Content = html.UnescapeString(report.Content) resp := new(models.ReportShareDetailResp) resp.Report = report // 免责声明 conf, e := models.GetBusinessConf() if e != nil { br.Msg = "获取失败" br.ErrMsg = "获取免责声明失败, Err: " + e.Error() return } if conf[models.BusinessConfDisclaimer] != "" { resp.Disclaimer = conf[models.BusinessConfDisclaimer] } // 研报分享抬头 if v, ok := conf[models.BusinessConfH5ShareName]; ok { resp.H5ShareName = v } if v, ok := conf[models.BusinessConfH5ReportShareImg]; ok { resp.H5ReportShareImg = v } br.Ret = 200 br.Success = true br.Msg = "获取成功" br.Data = resp }