ficc_report.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package controllers
  2. import (
  3. "hongze/hongze_clpt/models"
  4. "hongze/hongze_clpt/services"
  5. )
  6. type FiccYbController struct {
  7. BaseAuthController
  8. }
  9. // @Title 获取报告详情
  10. // @Description 获取报告详情接口
  11. // @Param ReportId query int true "报告ID"
  12. // @Success 200 {object} models.ArticleDetailResp
  13. // @router /detail [get]
  14. func (this *FiccYbController) Detail() {
  15. br := new(models.BaseResponse).Init()
  16. defer func() {
  17. this.Data["json"] = br
  18. this.ServeJSON()
  19. }()
  20. user := this.User
  21. if user == nil {
  22. br.Msg = "请登录"
  23. br.ErrMsg = "请登录,用户信息为空"
  24. br.Ret = 408
  25. return
  26. }
  27. //uid := user.UserId
  28. reportId, err := this.GetInt("ReportId")
  29. if err != nil {
  30. br.Msg = "文章不存在"
  31. br.ErrMsg = "文章不存在,文章ID错误" + err.Error()
  32. return
  33. }
  34. if reportId <= 0 {
  35. br.Msg = "文章不存在"
  36. br.ErrMsg = "文章不存在,文章ID错误"
  37. return
  38. }
  39. detail, err := services.GetReportDetail(user, reportId)
  40. if err != nil {
  41. br.Msg = "文章不存在"
  42. br.ErrMsg = "获取研报信息失败" + err.Error()
  43. return
  44. }
  45. br.Ret = 200
  46. br.Success = true
  47. br.Msg = "获取成功"
  48. br.Data = detail
  49. }