quote.go 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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. // QueryTHJListing
  85. // @Summary 查询供求列表
  86. // @Produce json
  87. // @Security ApiKeyAuth
  88. // @Param wrstandardname query string false "现货商品名称(模糊查询)"
  89. // @Param page query int false "页码"
  90. // @Param pagesize query int false "每页条数"
  91. // @Success 200 {array} models.THJWrstandard
  92. // @Failure 500 {object} app.Response
  93. // @Router /Ferroalloy/QueryTHJListing [get]
  94. // @Tags 铁合金
  95. func QueryTHJListing(c *gin.Context) {
  96. a := app.GinUtils{Gin: app.Gin{C: c}}
  97. m := models.THJWrstandard{GoodsType: 1}
  98. a.DoBindReq(&m)
  99. a.DoGetDataByPage(&m)
  100. }
  101. // QueryTHJWrstandardDetail
  102. // @Summary 查询采购详情
  103. // @Produce json
  104. // @Security ApiKeyAuth
  105. // @Param wrstandardid query int true "现货商品ID"
  106. // @Success 200 {array} models.THJWrstandardDetailRsp
  107. // @Failure 500 {object} app.Response
  108. // @Router /Ferroalloy/QueryTHJWrstandardDetail [get]
  109. // @Tags 铁合金
  110. func QueryTHJWrstandardDetail(c *gin.Context) {
  111. a := app.GinUtils{Gin: app.Gin{C: c}}
  112. m := models.THJWrstandardDetailReq{}
  113. if err := a.C.ShouldBind(&m); err != nil {
  114. a.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  115. return
  116. }
  117. if rsp, err := m.GetTHJWrstandardDetail(); err == nil {
  118. a.Gin.Response(http.StatusOK, e.SUCCESS, rsp)
  119. } else {
  120. logger.GetLogger().Errorf("query fail, %v", err)
  121. a.Gin.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  122. }
  123. }
  124. // QueryTHJPurchaseTransfer
  125. // @Summary 查询合同转让列表
  126. // @Produce json
  127. // @Security ApiKeyAuth
  128. // @Param wrstandardname query string false "现货商品名称(模糊查询)"
  129. // @Param page query int false "页码"
  130. // @Param pagesize query int false "每页条数"
  131. // @Success 200 {array} models.PurchaseTransfer
  132. // @Failure 500 {object} app.Response
  133. // @Router /Ferroalloy/QueryTHJPurchaseTransfer [get]
  134. // @Tags 铁合金
  135. func QueryTHJPurchaseTransfer(c *gin.Context) {
  136. a := app.GinUtils{Gin: app.Gin{C: c}}
  137. m := models.PurchaseTransfer{}
  138. a.DoBindReq(&m)
  139. a.DoGetDataByPage(&m)
  140. }
  141. // QueryTHJPurchaseTransferDetail
  142. // @Summary 查询合同转让详情
  143. // @Produce json
  144. // @Security ApiKeyAuth
  145. // @Param wrstandardid query int true "现货商品ID"
  146. // @Success 200 {array} models.THJPurchaseTradeDetailRsp
  147. // @Failure 500 {object} app.Response
  148. // @Router /Ferroalloy/QueryTHJPurchaseTransferDetail [get]
  149. // @Tags 铁合金
  150. func QueryTHJPurchaseTransferDetail(c *gin.Context) {
  151. a := app.GinUtils{Gin: app.Gin{C: c}}
  152. m := models.THJPurchaseTradeDetailReq{}
  153. if err := a.C.ShouldBind(&m); err != nil {
  154. a.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  155. return
  156. }
  157. if rsp, err := m.GetData(); err == nil {
  158. a.Gin.Response(http.StatusOK, e.SUCCESS, rsp)
  159. } else {
  160. logger.GetLogger().Errorf("query fail, %v", err)
  161. a.Gin.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  162. }
  163. }
  164. // QuerySpotgoodsPrice
  165. // @Summary 查询行情-现货列表
  166. // @Produce json
  167. // @Security ApiKeyAuth
  168. // @Param page query int false "页码"
  169. // @Param pagesize query int false "每页条数"
  170. // @Success 200 {array} models.Spotgoodsprice
  171. // @Failure 500 {object} app.Response
  172. // @Router /Ferroalloy/QuerySpotgoodsPrice [get]
  173. // @Tags 铁合金
  174. func QuerySpotgoodsPrice(c *gin.Context) {
  175. a := app.GinUtils{Gin: app.Gin{C: c}}
  176. m := models.Spotgoodsprice{}
  177. a.DoBindReq(&m)
  178. a.DoGetDataByPage(&m)
  179. }