package ferroalloy import ( "mtp2_if/global/app" "mtp2_if/global/e" "mtp2_if/logger" "mtp2_if/models" "net/http" "github.com/gin-gonic/gin" ) // GetSpotGoodsPrice // @Summary 获取现货行情 // @Produce json // @Security ApiKeyAuth // @Param page query int false "页码" // @Param pagesize query int false "每页条数" // @Success 200 {array} models.GErmcpspotgoodsprice // @Failure 500 {object} app.Response // @Router /Ferroalloy/GetSpotGoodsPrice [get] // @Tags 铁合金 func GetSpotGoodsPrice(c *gin.Context) { a := app.GinUtils{Gin: app.Gin{C: c}} m := models.GErmcpspotgoodsprice{} a.DoBindReq(&m) a.DoGetDataByPage(&m) } // QueryTHJProduct // @Summary 获取产品介绍列表 // @Produce json // @Security ApiKeyAuth // @Param userid query int true "用户ID" // @Param favoriteflag query bool false "关注标志 true-已关注 false-未关注" // @Param page query int false "页码" // @Param pagesize query int false "每页条数" // @Success 200 {array} models.THJProduct // @Failure 500 {object} app.Response // @Router /Ferroalloy/QueryTHJProduct [get] // @Tags 铁合金 func QueryTHJProduct(c *gin.Context) { a := app.GinUtils{Gin: app.Gin{C: c}} m := models.THJProduct{} a.DoBindReq(&m) a.DoGetDataByPage(&m) } // QueryTHJGoodsDetail // @Summary 查询商品详情 // @Produce json // @Security ApiKeyAuth // @Param wrstandardid query int true "现货商品ID" // @Success 200 {array} models.THJGoodsDetailRsp // @Failure 500 {object} app.Response // @Router /Ferroalloy/QueryTHJGoodsDetail [get] // @Tags 铁合金 func QueryTHJGoodsDetail(c *gin.Context) { a := app.GinUtils{Gin: app.Gin{C: c}} m := models.THJGoodsDetailReq{} if err := a.C.ShouldBind(&m); err != nil { a.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil) return } if rsp, err := m.GetTHJGoodsDetail(); err == nil { a.Gin.Response(http.StatusOK, e.SUCCESS, rsp) } else { logger.GetLogger().Errorf("query fail, %v", err) a.Gin.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil) } }