quote.go 2.1 KB

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