audit_result.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. package http
  2. import (
  3. "fmt"
  4. "net/url"
  5. "go-common/app/admin/main/tv/model"
  6. bm "go-common/library/net/http/blademaster"
  7. )
  8. func epResult(c *bm.Context) {
  9. var (
  10. req = c.Request.Form
  11. err error
  12. page int
  13. order int
  14. )
  15. if page, order, err = paramFilter(req); err != nil {
  16. c.JSON(nil, err)
  17. return
  18. }
  19. c.JSON(tvSrv.EpResult(req, page, order))
  20. }
  21. func seasonResult(c *bm.Context) {
  22. var (
  23. req = c.Request.Form
  24. err error
  25. page int
  26. order int
  27. )
  28. if page, order, err = paramFilter(req); err != nil {
  29. c.JSON(nil, err)
  30. return
  31. }
  32. c.JSON(tvSrv.SeasonResult(req, page, order))
  33. }
  34. // filter the params: page & order
  35. func paramFilter(req url.Values) (page int, order int, err error) {
  36. page = atoi(req.Get("page"))
  37. order = atoi(req.Get("order"))
  38. if page == 0 {
  39. page = 1
  40. }
  41. if order == 0 {
  42. order = 1
  43. }
  44. if order != 1 && order != 2 {
  45. err = fmt.Errorf("Param Order %d is incorrect", order)
  46. return
  47. }
  48. return
  49. }
  50. func arcResult(c *bm.Context) {
  51. v := new(model.ReqArcCons)
  52. if err := c.Bind(v); err != nil {
  53. return
  54. }
  55. c.JSON(tvSrv.ArcResult(c, v))
  56. }
  57. func videoResult(c *bm.Context) {
  58. v := new(model.ReqVideoCons)
  59. if err := c.Bind(v); err != nil {
  60. return
  61. }
  62. c.JSON(tvSrv.VideoResult(c, v))
  63. }