report.go 690 B

12345678910111213141516171819202122232425262728293031
  1. package report
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "hongze/hongze_yb/controller/response"
  5. "hongze/hongze_yb/services/report"
  6. userService "hongze/hongze_yb/services/user"
  7. "strconv"
  8. )
  9. func Detail(c *gin.Context) {
  10. reqReportId := c.DefaultQuery("report_id", "")
  11. if reqReportId == ""{
  12. response.Fail("请输入报告ID", c)
  13. return
  14. }
  15. reportId, err := strconv.Atoi(reqReportId)
  16. if err != nil {
  17. response.Fail("报告ID格式有误", c)
  18. return
  19. }
  20. userinfo := userService.GetInfoByClaims(c)
  21. reportDetail, err := report.GetReportDetail(userinfo, reportId)
  22. if err != nil {
  23. response.Fail(err.Error(), c)
  24. return
  25. }
  26. response.OkData("查询成功", reportDetail, c )
  27. return
  28. }