mango.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package http
  2. import (
  3. "go-common/app/admin/main/tv/model"
  4. bm "go-common/library/net/http/blademaster"
  5. )
  6. func mangoList(c *bm.Context) {
  7. c.JSON(tvSrv.MangoList(c))
  8. }
  9. func mangoAdd(c *bm.Context) {
  10. param := new(struct {
  11. IDs []int64 `form:"rids,split" validate:"required,min=1,dive,gt=0"`
  12. RType int `form:"rtype" validate:"required,min=1,max=2"` // 1=pgc, 2=ugc
  13. })
  14. if err := c.Bind(param); err != nil {
  15. return
  16. }
  17. c.JSON(tvSrv.MangoAdd(c, param.RType, param.IDs))
  18. }
  19. func mangoEdit(c *bm.Context) {
  20. param := new(model.ReqMangoEdit)
  21. if err := c.Bind(param); err != nil {
  22. return
  23. }
  24. c.JSON(nil, tvSrv.MangoEdit(c, param))
  25. }
  26. func mangoDel(c *bm.Context) {
  27. param := new(struct {
  28. ID int64 `form:"id" validate:"required,min=1,gt=0"`
  29. })
  30. if err := c.Bind(param); err != nil {
  31. return
  32. }
  33. c.JSON(nil, tvSrv.MangoDel(c, param.ID))
  34. }
  35. func mangoPub(c *bm.Context) {
  36. param := new(struct {
  37. IDs []int64 `form:"ids,split" validate:"required,min=1,dive,gt=0"`
  38. })
  39. if err := c.Bind(param); err != nil {
  40. return
  41. }
  42. c.JSON(nil, tvSrv.MangoPub(c, param.IDs))
  43. }