|
@@ -13,8 +13,8 @@ type ReportShareController struct {
|
|
|
|
|
|
// @Title 日评详情
|
|
|
// @Description 日评详情接口
|
|
|
-// @Param ReportId query int true "报告id"
|
|
|
-// @Success 200 {object} models.ReportDetailResp
|
|
|
+// @Param ReportCode query string true "报告唯一编码"
|
|
|
+// @Success 200 {object} models.ReportShareDetailResp
|
|
|
// @router /share/detail [get]
|
|
|
func (this *ReportShareController) Detail() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
@@ -23,49 +23,25 @@ func (this *ReportShareController) Detail() {
|
|
|
this.ServeJSON()
|
|
|
}()
|
|
|
|
|
|
- var status int
|
|
|
- var msg string
|
|
|
- reportId, err := this.GetInt("ReportId")
|
|
|
- if err != nil {
|
|
|
- br.Msg = "参数获取失败"
|
|
|
- br.ErrMsg = "参数获取失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- if reportId <= 0 {
|
|
|
+ reportCode:= this.GetString("ReportCode")
|
|
|
+
|
|
|
+ if reportCode =="" {
|
|
|
br.Msg = "参数错误"
|
|
|
- br.ErrMsg = "参数错误,报告id小于等于0"
|
|
|
+ br.ErrMsg = "参数错误,reportCode 为空"
|
|
|
return
|
|
|
}
|
|
|
- report, err := models.GetReportById(reportId)
|
|
|
+ report, err := models.GetReportByCode(reportCode)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取报告详情失败"
|
|
|
br.ErrMsg = "获取报告详情失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- if report == nil {
|
|
|
- status = 1
|
|
|
- msg = "报告不存在"
|
|
|
- }
|
|
|
+
|
|
|
report.ContentSub = html.UnescapeString(report.ContentSub)
|
|
|
report.Content = html.UnescapeString(report.Content)
|
|
|
|
|
|
- resp := new(models.ReportDetailResp)
|
|
|
- resp.Status = status
|
|
|
- resp.Msg = msg
|
|
|
+ resp := new(models.ReportShareDetailResp)
|
|
|
resp.Report = report
|
|
|
- recommendList, err := models.GetRecommendList(reportId)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取报告详情失败"
|
|
|
- br.ErrMsg = "获取报告推荐列表信息失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- recommendListLen := len(recommendList)
|
|
|
- for i := 0; i < recommendListLen; i++ {
|
|
|
- item := recommendList[i]
|
|
|
- recommendList[i].Content = html.UnescapeString(item.Content)
|
|
|
- recommendList[i].ContentSub = html.UnescapeString(item.ContentSub)
|
|
|
- }
|
|
|
- resp.RecommendList = recommendList
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
br.Msg = "获取成功"
|