tree.go 780 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package http
  2. import (
  3. "go-common/app/admin/main/esports/model"
  4. "go-common/library/ecode"
  5. bm "go-common/library/net/http/blademaster"
  6. )
  7. func addTree(c *bm.Context) {
  8. v := new(model.Tree)
  9. if err := c.Bind(v); err != nil {
  10. return
  11. }
  12. if v.Pid > 0 && v.RootID == 0 {
  13. c.JSON(nil, ecode.RequestErr)
  14. return
  15. }
  16. c.JSON(esSvc.AddTree(c, v))
  17. }
  18. func editTree(c *bm.Context) {
  19. v := new(model.TreeEditParam)
  20. if err := c.Bind(v); err != nil {
  21. return
  22. }
  23. c.JSON(nil, esSvc.EditTree(c, v))
  24. }
  25. func delTree(c *bm.Context) {
  26. v := new(model.TreeDelParam)
  27. if err := c.Bind(v); err != nil {
  28. return
  29. }
  30. c.JSON(nil, esSvc.DelTree(c, v))
  31. }
  32. func listTree(c *bm.Context) {
  33. v := new(model.TreeListParam)
  34. if err := c.Bind(v); err != nil {
  35. return
  36. }
  37. c.JSON(esSvc.TreeList(c, v))
  38. }