authority.go 775 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package http
  2. import (
  3. "go-common/library/log"
  4. "go-common/library/net/http/blademaster"
  5. )
  6. func addAuthority(c *blademaster.Context) {
  7. v := new(struct {
  8. MIDS []int64 `form:"mids,split" validate:"required"`
  9. })
  10. if err := c.Bind(v); err != nil {
  11. return
  12. }
  13. num, err := svr.AddAuthority(c, v.MIDS)
  14. if err != nil {
  15. log.Error("svr.AddAuthority error(%v) arg(%v)", err, v)
  16. c.JSON(nil, err)
  17. return
  18. }
  19. c.JSON(num, nil)
  20. }
  21. func removeAuthority(c *blademaster.Context) {
  22. v := new(struct {
  23. MIDS []int64 `form:"mids,split" validate:"required"`
  24. })
  25. if err := c.Bind(v); err != nil {
  26. return
  27. }
  28. num, err := svr.RemoveAuthority(c, v.MIDS)
  29. if err != nil {
  30. log.Error("svr.RemoveAuthority error(%v) arg(%v)", err, v)
  31. c.JSON(nil, err)
  32. return
  33. }
  34. c.JSON(num, nil)
  35. }