track.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. package http
  2. import (
  3. "strconv"
  4. "go-common/library/ecode"
  5. "go-common/library/log"
  6. bm "go-common/library/net/http/blademaster"
  7. )
  8. // trackArchive get archive list.
  9. func trackArchive(c *bm.Context) {
  10. params := c.Request.Form
  11. aidStr := params.Get("aid")
  12. aid, err := strconv.ParseInt(aidStr, 10, 64)
  13. if err != nil {
  14. c.JSON(nil, ecode.RequestErr)
  15. return
  16. }
  17. arcTrack, err := vdaSvc.TrackArchiveInfo(c, aid)
  18. if err != nil {
  19. log.Error("vdaSvc.TrackArchiveInfo (aid(%d)) error(%v)", aid, err)
  20. c.JSON(nil, ecode.RequestErr)
  21. return
  22. }
  23. c.JSON(arcTrack, nil)
  24. }
  25. //trackDetail 稿件信视频息追踪详情页
  26. func trackDetail(c *bm.Context) {
  27. params := c.Request.Form
  28. hidStr := params.Get("hid")
  29. hid, err := strconv.ParseInt(hidStr, 10, 64)
  30. if err != nil {
  31. log.Error("vdaSvc.trackDetail strconv.ParseInt(%s) error(%v)", hidStr, err)
  32. c.JSON(nil, err)
  33. return
  34. }
  35. history, err := vdaSvc.TrackHistoryDetail(c, hid)
  36. if err != nil {
  37. log.Error("vdaSvc.TrackHistoryDetail (hid(%d)) error(%v)", hid, err)
  38. c.JSON(nil, err)
  39. return
  40. }
  41. c.JSON(history, nil)
  42. }
  43. // trackVideo get video process.
  44. func trackVideo(c *bm.Context) {
  45. params := c.Request.Form
  46. fn := params.Get("filename")
  47. aid, err := strconv.ParseInt(params.Get("aid"), 10, 64)
  48. if err != nil {
  49. log.Error("trackVideo strconv.ParseInt error(%v) aid(%s)", err, params.Get("aid"))
  50. c.JSON(nil, ecode.RequestErr)
  51. return
  52. }
  53. // video
  54. video, err := vdaSvc.TrackVideo(c, fn, aid)
  55. if err != nil {
  56. log.Error("vdaSvc.TrackVideo(%s, aid(%d)) error(%v)", fn, aid, err)
  57. c.JSON(nil, err)
  58. return
  59. }
  60. c.JSON(video, nil)
  61. }