mine.go 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. package ferroalloy
  2. import (
  3. "mtp2_if/global/app"
  4. "mtp2_if/global/e"
  5. "mtp2_if/logger"
  6. "mtp2_if/models"
  7. "net/http"
  8. "github.com/gin-gonic/gin"
  9. )
  10. // QueryMyRefer
  11. // @Summary 查询我的推荐列表
  12. // @Produce json
  13. // @Security ApiKeyAuth
  14. // @Param userid query int true "用户ID"
  15. // @Param page query int false "页码"
  16. // @Param pagesize query int false "每页条数"
  17. // @Success 200 {array} models.MyRefer
  18. // @Failure 500 {object} app.Response
  19. // @Router /Ferroalloy/QueryMyRefer [get]
  20. // @Tags 铁合金
  21. func QueryMyRefer(c *gin.Context) {
  22. a := app.GinUtils{Gin: app.Gin{C: c}}
  23. m := models.MyRefer{}
  24. a.DoBindReq(&m)
  25. a.DoGetDataByPage(&m)
  26. }
  27. // QueryMyRegisterMoney
  28. // @Summary 查询我的注册红包
  29. // @Produce json
  30. // @Param accountid query int true "资金账户"
  31. // @Success 200 {array} models.RegisterMoney
  32. // @Failure 500 {object} app.Response
  33. // @Router /Ferroalloy/QueryMyRegisterMoney [get]
  34. // @Tags 铁合金
  35. func QueryMyRegisterMoney(c *gin.Context) {
  36. a := app.GinUtils{Gin: app.Gin{C: c}}
  37. m := models.RegisterMoney{}
  38. a.DoBindReq(&m)
  39. a.DoGetDataEx(&m)
  40. }
  41. // QueryUserLevelInfo
  42. // @Summary 查询用户等级信息
  43. // @Produce json
  44. // @Security ApiKeyAuth
  45. // @Param userid query int true "用户ID"
  46. // @Success 200 {array} models.THJUserLevelInfo
  47. // @Failure 500 {object} app.Response
  48. // @Router /Ferroalloy/QueryUserLevelInfo [get]
  49. // @Tags 铁合金
  50. func QueryUserLevelInfo(c *gin.Context) {
  51. a := app.GinUtils{Gin: app.Gin{C: c}}
  52. m := models.THJUserLevelInfo{}
  53. if err := a.C.ShouldBind(&m); err != nil {
  54. a.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  55. return
  56. }
  57. if err := m.Get(); err == nil {
  58. a.Gin.Response(http.StatusOK, e.SUCCESS, m)
  59. } else {
  60. logger.GetLogger().Errorf("query fail, %v", err)
  61. a.Gin.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  62. }
  63. }
  64. // QueryInvestorLevelGroup
  65. // @Summary 查询查询我推荐的好友等级
  66. // @Produce json
  67. // @Success 200 {array} models.Thjinvestorlevelgroup
  68. // @Failure 500 {object} app.Response
  69. // @Router /Ferroalloy/QueryInvestorLevelGroup [get]
  70. // @Tags 铁合金
  71. func QueryInvestorLevelGroup(c *gin.Context) {
  72. a := app.GinUtils{Gin: app.Gin{C: c}}
  73. m := models.Thjinvestorlevelgroup{}
  74. a.DoBindReq(&m)
  75. a.DoGetDataEx(&m)
  76. }
  77. // QueryTHJFriends
  78. // @Summary 查询好友
  79. // @Produce json
  80. // @Security ApiKeyAuth
  81. // @Param userid query int true "用户ID"
  82. // @Param customername query string false "客户名称(企业名称),模糊查询"
  83. // @Param mobile query string false "手机号码(加密存储),加密串精确查询"
  84. // @Param levelgroupid query int false "等级ID"
  85. // @Param page query int false "页码"
  86. // @Param pagesize query int false "每页条数"
  87. // @Success 200 {array} models.THJFriend
  88. // @Failure 500 {object} app.Response
  89. // @Router /Ferroalloy/QueryTHJFriends [get]
  90. // @Tags 铁合金
  91. func QueryTHJFriends(c *gin.Context) {
  92. a := app.GinUtils{Gin: app.Gin{C: c}}
  93. m := models.THJFriend{}
  94. a.DoBindReq(&m)
  95. a.DoGetDataByPage(&m)
  96. }
  97. // QueryTHJProfits
  98. // @Summary 查询收益
  99. // @Produce json
  100. // @Security ApiKeyAuth
  101. // @Param userid query int true "用户ID"
  102. // @Param marketid query int false "市场ID"
  103. // @Param accountname query string false "好友名称,模糊查询"
  104. // @Param goods query string false "商品代码或商品名称,模糊查询"
  105. // @Param marketid query int false "分润机构角色 - 1:平台 2:经纪会员 3:一级交易商 4:二级交易商(枚举:THJProfitRoleType)"
  106. // @Param page query int false "页码"
  107. // @Param pagesize query int false "每页条数"
  108. // @Success 200 {array} models.THJProfit
  109. // @Failure 500 {object} app.Response
  110. // @Router /Ferroalloy/QueryTHJProfits [get]
  111. // @Tags 铁合金
  112. func QueryTHJProfits(c *gin.Context) {
  113. a := app.GinUtils{Gin: app.Gin{C: c}}
  114. m := models.THJProfit{}
  115. a.DoBindReq(&m)
  116. a.DoGetDataByPage(&m)
  117. }
  118. // QueryMyDeposit
  119. // @Summary 查询本人定金比例
  120. // @Produce json
  121. // @Security ApiKeyAuth
  122. // @Param userid query int true "用户ID"
  123. // @Success 200 {array} models.Thjinvesotrdeposit
  124. // @Failure 500 {object} app.Response
  125. // @Router /Ferroalloy/QueryMyDeposit [get]
  126. // @Tags 铁合金
  127. func QueryMyDeposit(c *gin.Context) {
  128. a := app.GinUtils{Gin: app.Gin{C: c}}
  129. m := models.QueryMyDepositReq{}
  130. if err := a.C.ShouldBind(&m); err != nil {
  131. a.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  132. return
  133. }
  134. var r models.Thjinvesotrdeposit
  135. if rsp, err := r.GetAll(m); err == nil {
  136. a.Gin.Response(http.StatusOK, e.SUCCESS, rsp)
  137. } else {
  138. logger.GetLogger().Errorf("query fail, %v", err)
  139. a.Gin.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  140. }
  141. }