trade.go 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. }