video.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. package http
  2. import (
  3. "go-common/app/service/bbq/video/api/grpc/v1"
  4. grpc "go-common/app/service/bbq/video/api/grpc/v1"
  5. httpV1 "go-common/app/service/bbq/video/api/http/v1"
  6. "go-common/library/log"
  7. bm "go-common/library/net/http/blademaster"
  8. "github.com/pkg/errors"
  9. )
  10. // example for http request handler
  11. func bvcTransBack(c *bm.Context) {
  12. arg := new(v1.BVCTransBackRequset)
  13. err := bindJSON(c, arg)
  14. if err == nil {
  15. err = srv.BVCTransRes(c, arg)
  16. }
  17. c.JSON(nil, err)
  18. }
  19. func bvcTransCommit(c *bm.Context) {
  20. arg := new(v1.BVideoTransRequset)
  21. err := c.Bind(arg)
  22. if err != nil {
  23. errors.Wrap(err, "参数验证失败")
  24. return
  25. }
  26. c.JSON(srv.BVCTransCommit(c, arg))
  27. }
  28. func createID(c *bm.Context) {
  29. arg := new(v1.CreateIDRequest)
  30. err := c.Bind(arg)
  31. if err != nil {
  32. errors.Wrap(err, "参数验证失败")
  33. return
  34. }
  35. c.JSON(srv.CreateID(c, arg))
  36. }
  37. func videoViewsAdd(c *bm.Context) {
  38. arg := new(httpV1.ViewsAddRequest)
  39. if err := c.Bind(arg); err != nil {
  40. errors.Wrap(err, "参数验证失败")
  41. return
  42. }
  43. c.JSON(srv.VideoViewsAdd(c, arg))
  44. }
  45. func videoStat(c *bm.Context) {
  46. arg := new(grpc.SvStatisticsInfoReq)
  47. if err := bindJSON(c, arg); err != nil {
  48. errors.Wrap(err, "参数验证失败")
  49. return
  50. }
  51. c.JSON(srv.SvStatisticsInfo(c, arg))
  52. }
  53. func limitsModify(c *bm.Context) {
  54. arg := new(grpc.ModifyLimitsRequest)
  55. if err := c.Bind(arg); err != nil {
  56. errors.Wrap(err, "参数验证失败")
  57. return
  58. }
  59. c.JSON(srv.ModifyLimits(c, arg))
  60. }
  61. func svPlays(c *bm.Context) {
  62. arg := new(grpc.PlayInfoRequest)
  63. if err := bindJSON(c, arg); err != nil {
  64. log.Error("param err:%v", err)
  65. return
  66. }
  67. c.JSON(srv.PlayInfo(c, arg))
  68. }