web_staff.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package http
  2. import (
  3. "go-common/library/ecode"
  4. bm "go-common/library/net/http/blademaster"
  5. )
  6. //staff only
  7. func webApplySubmit(c *bm.Context) {
  8. v := new(struct {
  9. ID int64 `form:"id" validate:"required"`
  10. AID int64 `form:"aid" validate:"required"`
  11. Type int64 `form:"type" validate:"required"`
  12. MID int64 `form:"mid" validate:"required"`
  13. FlagAddBlack int `form:"flag_add_black" `
  14. FlagRejuse int `form:"flag_rejuse"`
  15. State int64 `form:"state" validate:"min=1,max=5"`
  16. })
  17. if err := c.Bind(v); err != nil {
  18. return
  19. }
  20. // check user
  21. _, ok := c.Get("mid")
  22. if !ok {
  23. c.JSON(nil, ecode.NoLogin)
  24. return
  25. }
  26. c.JSON(nil, arcSvc.StaffApplySubmit(c, v.ID, v.AID, v.MID, v.State, v.Type, v.FlagAddBlack, v.FlagRejuse))
  27. }
  28. //staff only
  29. func webApplyCreate(c *bm.Context) {
  30. v := new(struct {
  31. AID int64 `form:"aid" validate:"required"`
  32. MID int64 `form:"mid" validate:"required"`
  33. })
  34. if err := c.Bind(v); err != nil {
  35. return
  36. }
  37. // check user
  38. _, ok := c.Get("mid")
  39. if !ok {
  40. c.JSON(nil, ecode.NoLogin)
  41. return
  42. }
  43. c.JSON(nil, arcSvc.StaffApplySubmit(c, 0, v.AID, v.MID, 0, 4, 0, 0))
  44. }