report.go 1019 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package controllers
  2. import (
  3. "encoding/json"
  4. "eta/eta_pub/models"
  5. "eta/eta_pub/services"
  6. )
  7. // ReportController 报告模块
  8. type ReportController struct {
  9. BaseAuthController
  10. }
  11. // HandleVideoDecibel
  12. // @Title 处理音频分贝大小
  13. // @Description 处理音频分贝大小
  14. // @Success 200 处理成功
  15. // @router /handle_video_decibel [post]
  16. func (this *ReportController) HandleVideoDecibel() {
  17. br := new(models.BaseResponse).Init()
  18. defer func() {
  19. this.Data["json"] = br
  20. this.ServeJSON()
  21. }()
  22. body := this.Ctx.Input.RequestBody
  23. req := new(models.ReportChapterReq)
  24. err := json.Unmarshal(body, &req)
  25. if err != nil {
  26. br.Msg = "参数解析失败"
  27. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  28. return
  29. }
  30. chapterInfo, err := models.GetReportChapterInfoById(req.ReportChapterId)
  31. if err != nil {
  32. br.Msg = "章节信息有误"
  33. br.ErrMsg = "获取章节信息失败, Err: " + err.Error()
  34. return
  35. }
  36. services.HandleVideoDecibel(chapterInfo)
  37. br.Ret = 200
  38. br.Msg = "处理成功"
  39. return
  40. }