vip_welfare.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package http
  2. import (
  3. "go-common/library/ecode"
  4. "go-common/library/log"
  5. bm "go-common/library/net/http/blademaster"
  6. )
  7. func welfareList(c *bm.Context) {
  8. arg := new(struct {
  9. Tid int64 `form:"tid"`
  10. Recommend int64 `form:"recommend"`
  11. Pn int64 `form:"pn"`
  12. Ps int64 `form:"ps"`
  13. })
  14. if err := c.Bind(arg); err != nil {
  15. log.Error("c.Bind err(%+v)", err)
  16. return
  17. }
  18. c.JSON(vipSvc.WelfareList(c, arg.Tid, arg.Recommend, arg.Pn, arg.Ps))
  19. }
  20. func welfareTypeList(c *bm.Context) {
  21. c.JSON(vipSvc.WelfareTypeList(c))
  22. }
  23. func welfareInfo(c *bm.Context) {
  24. userId := int64(0)
  25. mid, exists := c.Get("mid")
  26. if exists {
  27. userId = mid.(int64)
  28. }
  29. arg := new(struct {
  30. Wid int64 `form:"id"`
  31. })
  32. if err := c.Bind(arg); err != nil {
  33. log.Error("c.Bind err(%+v)", err)
  34. return
  35. }
  36. c.JSON(vipSvc.WelfareInfo(c, arg.Wid, userId))
  37. }
  38. func receiveWelfare(c *bm.Context) {
  39. mid, exists := c.Get("mid")
  40. if !exists {
  41. c.JSON(nil, ecode.NoLogin)
  42. return
  43. }
  44. arg := new(struct {
  45. Wid int64 `form:"id"`
  46. })
  47. if err := c.Bind(arg); err != nil {
  48. log.Error("c.Bind err(%+v)", err)
  49. return
  50. }
  51. c.JSON(vipSvc.WelfareReceive(c, arg.Wid, mid.(int64)))
  52. }
  53. func myWelfare(c *bm.Context) {
  54. mid, exists := c.Get("mid")
  55. if !exists {
  56. c.JSON(nil, ecode.NoLogin)
  57. return
  58. }
  59. c.JSON(vipSvc.MyWelfare(c, mid.(int64)))
  60. }