acc.go 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. package http
  2. import (
  3. "go-common/app/service/main/account/model"
  4. bm "go-common/library/net/http/blademaster"
  5. )
  6. // info
  7. func info(c *bm.Context) {
  8. p := new(model.ParamMid)
  9. if err := c.Bind(p); err != nil {
  10. return
  11. }
  12. info, err := accSvc.Info(c, p.Mid)
  13. if err != nil {
  14. c.JSON(nil, err)
  15. return
  16. }
  17. c.JSON(info, nil)
  18. }
  19. // infoByName
  20. func infoByName(c *bm.Context) {
  21. p := new(model.ParamNames)
  22. if err := c.Bind(p); err != nil {
  23. return
  24. }
  25. infos, err := accSvc.InfosByName(c, p.Names)
  26. if err != nil {
  27. c.JSON(nil, err)
  28. return
  29. }
  30. c.JSON(infos, nil)
  31. }
  32. // infos
  33. func infos(c *bm.Context) {
  34. p := new(model.ParamMids)
  35. if err := c.Bind(p); err != nil {
  36. return
  37. }
  38. infos, err := accSvc.Infos(c, p.Mids)
  39. if err != nil {
  40. c.JSON(nil, err)
  41. return
  42. }
  43. c.JSON(infos, nil)
  44. }
  45. // card
  46. func card(c *bm.Context) {
  47. p := new(model.ParamMid)
  48. if err := c.Bind(p); err != nil {
  49. return
  50. }
  51. card, err := accSvc.Card(c, p.Mid)
  52. if err != nil {
  53. c.JSON(nil, err)
  54. return
  55. }
  56. c.JSON(card, nil)
  57. }
  58. // cards
  59. func cards(c *bm.Context) {
  60. p := new(model.ParamMids)
  61. if err := c.Bind(p); err != nil {
  62. return
  63. }
  64. cards, err := accSvc.Cards(c, p.Mids)
  65. if err != nil {
  66. c.JSON(nil, err)
  67. return
  68. }
  69. c.JSON(cards, nil)
  70. }
  71. // vip
  72. func vip(c *bm.Context) {
  73. p := new(model.ParamMid)
  74. if err := c.Bind(p); err != nil {
  75. return
  76. }
  77. v, err := accSvc.Vip(c, p.Mid)
  78. if err != nil {
  79. c.JSON(nil, err)
  80. return
  81. }
  82. c.JSON(v, nil)
  83. }
  84. func vips(c *bm.Context) {
  85. p := new(model.ParamMids)
  86. if err := c.Bind(p); err != nil {
  87. return
  88. }
  89. c.JSON(accSvc.Vips(c, p.Mids))
  90. }
  91. // profile
  92. func profile(c *bm.Context) {
  93. p := new(model.ParamMid)
  94. if err := c.Bind(p); err != nil {
  95. return
  96. }
  97. pfl, err := accSvc.Profile(c, p.Mid)
  98. if err != nil {
  99. c.JSON(nil, err)
  100. return
  101. }
  102. c.JSON(pfl, nil)
  103. }
  104. // profileWithStat
  105. func profileWithStat(c *bm.Context) {
  106. p := new(model.ParamMid)
  107. if err := c.Bind(p); err != nil {
  108. return
  109. }
  110. pfl, err := accSvc.ProfileWithStat(c, p.Mid)
  111. if err != nil {
  112. c.JSON(nil, err)
  113. return
  114. }
  115. c.JSON(pfl, nil)
  116. }
  117. // privacy
  118. func privacy(c *bm.Context) {
  119. p := new(model.ParamMid)
  120. if err := c.Bind(p); err != nil {
  121. return
  122. }
  123. c.JSON(accSvc.Privacy(c, p.Mid))
  124. }