quote.go 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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. // GetSpotGoodsPrice
  11. // @Summary 获取现货行情
  12. // @Produce json
  13. // @Security ApiKeyAuth
  14. // @Param page query int false "页码"
  15. // @Param pagesize query int false "每页条数"
  16. // @Success 200 {array} models.GErmcpspotgoodsprice
  17. // @Failure 500 {object} app.Response
  18. // @Router /Ferroalloy/GetSpotGoodsPrice [get]
  19. // @Tags 铁合金
  20. func GetSpotGoodsPrice(c *gin.Context) {
  21. a := app.GinUtils{Gin: app.Gin{C: c}}
  22. m := models.GErmcpspotgoodsprice{}
  23. a.DoBindReq(&m)
  24. a.DoGetDataByPage(&m)
  25. }
  26. // QueryTHJProduct
  27. // @Summary 获取产品介绍列表
  28. // @Produce json
  29. // @Security ApiKeyAuth
  30. // @Param userid query int true "用户ID"
  31. // @Param favoriteflag query bool false "关注标志 true-已关注 false-未关注"
  32. // @Param page query int false "页码"
  33. // @Param pagesize query int false "每页条数"
  34. // @Success 200 {array} models.THJProduct
  35. // @Failure 500 {object} app.Response
  36. // @Router /Ferroalloy/QueryTHJProduct [get]
  37. // @Tags 铁合金
  38. func QueryTHJProduct(c *gin.Context) {
  39. a := app.GinUtils{Gin: app.Gin{C: c}}
  40. m := models.THJProduct{}
  41. a.DoBindReq(&m)
  42. a.DoGetDataByPage(&m)
  43. }
  44. // QueryTHJGoodsDetail
  45. // @Summary 查询商品详情
  46. // @Produce json
  47. // @Security ApiKeyAuth
  48. // @Param wrstandardid query int true "现货商品ID"
  49. // @Success 200 {array} models.THJGoodsDetailRsp
  50. // @Failure 500 {object} app.Response
  51. // @Router /Ferroalloy/QueryTHJGoodsDetail [get]
  52. // @Tags 铁合金
  53. func QueryTHJGoodsDetail(c *gin.Context) {
  54. a := app.GinUtils{Gin: app.Gin{C: c}}
  55. m := models.THJGoodsDetailReq{}
  56. if err := a.C.ShouldBind(&m); err != nil {
  57. a.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  58. return
  59. }
  60. if rsp, err := m.GetTHJGoodsDetail(); err == nil {
  61. a.Gin.Response(http.StatusOK, e.SUCCESS, rsp)
  62. } else {
  63. logger.GetLogger().Errorf("query fail, %v", err)
  64. a.Gin.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  65. }
  66. }
  67. // QueryTHJWrstandard
  68. // @Summary 查询采购列表
  69. // @Produce json
  70. // @Security ApiKeyAuth
  71. // @Param wrstandardname query string false "现货商品名称(模糊查询)"
  72. // @Param page query int false "页码"
  73. // @Param pagesize query int false "每页条数"
  74. // @Success 200 {array} models.THJWrstandard
  75. // @Failure 500 {object} app.Response
  76. // @Router /Ferroalloy/QueryTHJWrstandard [get]
  77. // @Tags 铁合金
  78. func QueryTHJWrstandard(c *gin.Context) {
  79. a := app.GinUtils{Gin: app.Gin{C: c}}
  80. m := models.THJWrstandard{}
  81. a.DoBindReq(&m)
  82. a.DoGetDataByPage(&m)
  83. }
  84. // QueryTHJWrstandardDetail
  85. // @Summary 查询采购详情
  86. // @Produce json
  87. // @Security ApiKeyAuth
  88. // @Param wrstandardid query int true "现货商品ID"
  89. // @Success 200 {array} models.THJWrstandardDetailRsp
  90. // @Failure 500 {object} app.Response
  91. // @Router /Ferroalloy/QueryTHJWrstandardDetail [get]
  92. // @Tags 铁合金
  93. func QueryTHJWrstandardDetail(c *gin.Context) {
  94. a := app.GinUtils{Gin: app.Gin{C: c}}
  95. m := models.THJWrstandardDetailReq{}
  96. if err := a.C.ShouldBind(&m); err != nil {
  97. a.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  98. return
  99. }
  100. if rsp, err := m.GetTHJWrstandardDetail(); err == nil {
  101. a.Gin.Response(http.StatusOK, e.SUCCESS, rsp)
  102. } else {
  103. logger.GetLogger().Errorf("query fail, %v", err)
  104. a.Gin.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  105. }
  106. }
  107. // QueryTHJPurchaseTransfer
  108. // @Summary 查询合同转让列表
  109. // @Produce json
  110. // @Security ApiKeyAuth
  111. // @Param wrstandardname query string false "现货商品名称(模糊查询)"
  112. // @Param page query int false "页码"
  113. // @Param pagesize query int false "每页条数"
  114. // @Success 200 {array} models.PurchaseTransfer
  115. // @Failure 500 {object} app.Response
  116. // @Router /Ferroalloy/QueryTHJPurchaseTransfer [get]
  117. // @Tags 铁合金
  118. func QueryTHJPurchaseTransfer(c *gin.Context) {
  119. a := app.GinUtils{Gin: app.Gin{C: c}}
  120. m := models.PurchaseTransfer{}
  121. a.DoBindReq(&m)
  122. a.DoGetDataByPage(&m)
  123. }
  124. // QueryTHJPurchaseTransferDetail
  125. // @Summary 查询合同转让详情
  126. // @Produce json
  127. // @Security ApiKeyAuth
  128. // @Param wrstandardid query int true "现货商品ID"
  129. // @Success 200 {array} models.THJPurchaseTradeDetailRsp
  130. // @Failure 500 {object} app.Response
  131. // @Router /Ferroalloy/QueryTHJPurchaseTransferDetail [get]
  132. // @Tags 铁合金
  133. func QueryTHJPurchaseTransferDetail(c *gin.Context) {
  134. a := app.GinUtils{Gin: app.Gin{C: c}}
  135. m := models.THJPurchaseTradeDetailReq{}
  136. if err := a.C.ShouldBind(&m); err != nil {
  137. a.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  138. return
  139. }
  140. if rsp, err := m.GetData(); err == nil {
  141. a.Gin.Response(http.StatusOK, e.SUCCESS, rsp)
  142. } else {
  143. logger.GetLogger().Errorf("query fail, %v", err)
  144. a.Gin.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  145. }
  146. }