video.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package http
  2. import (
  3. "time"
  4. "go-common/app/job/main/videoup-report/model/archive"
  5. "go-common/library/ecode"
  6. bm "go-common/library/net/http/blademaster"
  7. )
  8. // reportsByType request report by type
  9. func reportsByType(c *bm.Context, t int8) {
  10. req := c.Request
  11. params := req.Form
  12. stimeStr := params.Get("stime")
  13. etimeStr := params.Get("etime")
  14. if stimeStr == "" {
  15. stimeStr = time.Now().Format("2006-01-02") + " 00:00:00"
  16. }
  17. if etimeStr == "" {
  18. etimeStr = time.Now().Format("2006-01-02 15:04:05")
  19. }
  20. local, _ := time.LoadLocation("Local")
  21. stime, err := time.ParseInLocation("2006-01-02 15:04:05", stimeStr, local)
  22. if stime.Unix() < 1 || err != nil {
  23. c.JSON(nil, ecode.RequestErr)
  24. return
  25. }
  26. etime, err := time.ParseInLocation("2006-01-02 15:04:05", etimeStr, local)
  27. if etime.Unix() < 1 || err != nil {
  28. c.JSON(nil, ecode.RequestErr)
  29. return
  30. }
  31. c.JSON(vdaSvc.VideoReports(c, t, stime, etime))
  32. }
  33. // videoAudit get video audit reports
  34. func videoAudit(c *bm.Context) {
  35. reportsByType(c, archive.ReportTypeVideoAudit)
  36. }
  37. // videoXcode get video xcode reports
  38. func videoXcode(c *bm.Context) {
  39. reportsByType(c, archive.ReportTypeXcode)
  40. }