jointly.go 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package http
  2. import (
  3. "go-common/app/admin/main/vip/model"
  4. "go-common/library/ecode"
  5. bm "go-common/library/net/http/blademaster"
  6. )
  7. func jointlys(c *bm.Context) {
  8. arg := new(model.ArgQueryJointly)
  9. if err := c.Bind(arg); err != nil {
  10. return
  11. }
  12. c.JSON(vipSvc.JointlysByState(c, arg.State))
  13. }
  14. func addJointly(c *bm.Context) {
  15. arg := new(model.ArgAddJointly)
  16. if err := c.Bind(arg); err != nil {
  17. return
  18. }
  19. username, ok := c.Get("username")
  20. if !ok {
  21. c.JSON(nil, ecode.AccessDenied)
  22. return
  23. }
  24. arg.Operator = username.(string)
  25. c.JSON(nil, vipSvc.AddJointly(c, arg))
  26. }
  27. func modifyJointly(c *bm.Context) {
  28. arg := new(model.ArgModifyJointly)
  29. if err := c.Bind(arg); err != nil {
  30. return
  31. }
  32. username, ok := c.Get("username")
  33. if !ok {
  34. c.JSON(nil, ecode.AccessDenied)
  35. return
  36. }
  37. arg.Operator = username.(string)
  38. c.JSON(nil, vipSvc.ModifyJointly(c, arg))
  39. }
  40. func deleteJointly(c *bm.Context) {
  41. arg := new(model.ArgJointlyID)
  42. if err := c.Bind(arg); err != nil {
  43. return
  44. }
  45. c.JSON(nil, vipSvc.DeleteJointly(c, arg.ID))
  46. }