trade.go 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. // QueryTHJWrstandard
  11. // @Summary 查询采购列表
  12. // @Produce json
  13. // @Security ApiKeyAuth
  14. // @Param wrstandardname query string false "现货商品名称(模糊查询)"
  15. // @Param page query int false "页码"
  16. // @Param pagesize query int false "每页条数"
  17. // @Success 200 {array} models.THJWrstandard
  18. // @Failure 500 {object} app.Response
  19. // @Router /Ferroalloy/QueryTHJWrstandard [get]
  20. // @Tags 铁合金
  21. func QueryTHJWrstandard(c *gin.Context) {
  22. a := app.GinUtils{Gin: app.Gin{C: c}}
  23. m := models.THJWrstandard{}
  24. a.DoBindReq(&m)
  25. a.DoGetDataByPage(&m)
  26. }
  27. // QueryTHJWrstandardDetail
  28. // @Summary 查询采购详情
  29. // @Produce json
  30. // @Security ApiKeyAuth
  31. // @Param wrstandardid query int true "现货商品ID"
  32. // @Success 200 {array} models.THJWrstandardDetailRsp
  33. // @Failure 500 {object} app.Response
  34. // @Router /Ferroalloy/QueryTHJWrstandardDetail [get]
  35. // @Tags 铁合金
  36. func QueryTHJWrstandardDetail(c *gin.Context) {
  37. a := app.GinUtils{Gin: app.Gin{C: c}}
  38. m := models.THJWrstandardDetailReq{}
  39. if err := a.C.ShouldBind(&m); err != nil {
  40. a.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  41. return
  42. }
  43. if rsp, err := m.GetTHJWrstandardDetail(); err == nil {
  44. a.Gin.Response(http.StatusOK, e.SUCCESS, rsp)
  45. } else {
  46. logger.GetLogger().Errorf("query fail, %v", err)
  47. a.Gin.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  48. }
  49. }
  50. // QueryTHJPurchaseTradeDetail
  51. // @Summary 查询我的订单-采购订单
  52. // @Produce json
  53. // @Security ApiKeyAuth
  54. // @Param userid query int true "用户ID"
  55. // @Param type query int false "类型 - 0:未完成 1:已完成"
  56. // @Param page query int false "页码"
  57. // @Param pagesize query int false "每页条数"
  58. // @Success 200 {array} models.Thjpurchasetradedetail
  59. // @Failure 500 {object} app.Response
  60. // @Router /Ferroalloy/QueryTHJPurchaseTradeDetail [get]
  61. // @Tags 铁合金
  62. func QueryTHJPurchaseTradeDetail(c *gin.Context) {
  63. a := app.GinUtils{Gin: app.Gin{C: c}}
  64. m := models.Thjpurchasetradedetail{}
  65. a.DoBindReq(&m)
  66. a.DoGetDataByPage(&m)
  67. }
  68. // QueryTHJTradeData
  69. // @Summary 获取我的推广-交易数据
  70. // @Produce json
  71. // @Security ApiKeyAuth
  72. // @Param userid query int true "用户ID"
  73. // @Param marketid query int true "市场ID 采购-64201 供求-65201"
  74. // @Param page query int false "页码"
  75. // @Param pagesize query int false "每页条数"
  76. // @Success 200 {array} models.THJTradeData
  77. // @Failure 500 {object} app.Response
  78. // @Router /Ferroalloy/QueryTHJTradeData [get]
  79. // @Tags 铁合金
  80. func QueryTHJTradeData(c *gin.Context) {
  81. a := app.GinUtils{Gin: app.Gin{C: c}}
  82. m := models.THJTradeData{}
  83. a.DoBindReq(&m)
  84. a.DoGetDataByPage(&m)
  85. }