| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- 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)
- }
- }
- // QueryTHJWrstandard
- // @Summary 查询采购列表
- // @Produce json
- // @Security ApiKeyAuth
- // @Param wrstandardname query string false "现货商品名称(模糊查询)"
- // @Param page query int false "页码"
- // @Param pagesize query int false "每页条数"
- // @Success 200 {array} models.THJWrstandard
- // @Failure 500 {object} app.Response
- // @Router /Ferroalloy/QueryTHJWrstandard [get]
- // @Tags 铁合金
- func QueryTHJWrstandard(c *gin.Context) {
- a := app.GinUtils{Gin: app.Gin{C: c}}
- m := models.THJWrstandard{}
- a.DoBindReq(&m)
- a.DoGetDataByPage(&m)
- }
- // QueryTHJListing
- // @Summary 查询供求列表
- // @Produce json
- // @Security ApiKeyAuth
- // @Param wrstandardname query string false "现货商品名称(模糊查询)"
- // @Param page query int false "页码"
- // @Param pagesize query int false "每页条数"
- // @Success 200 {array} models.THJWrstandard
- // @Failure 500 {object} app.Response
- // @Router /Ferroalloy/QueryTHJListing [get]
- // @Tags 铁合金
- func QueryTHJListing(c *gin.Context) {
- a := app.GinUtils{Gin: app.Gin{C: c}}
- m := models.THJWrstandard{GoodsType: 1}
- a.DoBindReq(&m)
- a.DoGetDataByPage(&m)
- }
- // QueryTHJWrstandardDetail
- // @Summary 查询采购详情
- // @Produce json
- // @Security ApiKeyAuth
- // @Param wrstandardid query int true "现货商品ID"
- // @Success 200 {array} models.THJWrstandardDetailRsp
- // @Failure 500 {object} app.Response
- // @Router /Ferroalloy/QueryTHJWrstandardDetail [get]
- // @Tags 铁合金
- func QueryTHJWrstandardDetail(c *gin.Context) {
- a := app.GinUtils{Gin: app.Gin{C: c}}
- m := models.THJWrstandardDetailReq{}
- if err := a.C.ShouldBind(&m); err != nil {
- a.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
- return
- }
- if rsp, err := m.GetTHJWrstandardDetail(); 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)
- }
- }
- // QueryTHJPurchaseTransfer
- // @Summary 查询合同转让列表
- // @Produce json
- // @Security ApiKeyAuth
- // @Param wrstandardname query string false "现货商品名称(模糊查询)"
- // @Param page query int false "页码"
- // @Param pagesize query int false "每页条数"
- // @Success 200 {array} models.PurchaseTransfer
- // @Failure 500 {object} app.Response
- // @Router /Ferroalloy/QueryTHJPurchaseTransfer [get]
- // @Tags 铁合金
- func QueryTHJPurchaseTransfer(c *gin.Context) {
- a := app.GinUtils{Gin: app.Gin{C: c}}
- m := models.PurchaseTransfer{}
- a.DoBindReq(&m)
- a.DoGetDataByPage(&m)
- }
- // QueryTHJPurchaseTransferDetail
- // @Summary 查询合同转让详情
- // @Produce json
- // @Security ApiKeyAuth
- // @Param wrstandardid query int true "现货商品ID"
- // @Success 200 {array} models.THJPurchaseTradeDetailRsp
- // @Failure 500 {object} app.Response
- // @Router /Ferroalloy/QueryTHJPurchaseTransferDetail [get]
- // @Tags 铁合金
- func QueryTHJPurchaseTransferDetail(c *gin.Context) {
- a := app.GinUtils{Gin: app.Gin{C: c}}
- m := models.THJPurchaseTradeDetailReq{}
- if err := a.C.ShouldBind(&m); err != nil {
- a.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
- return
- }
- if rsp, err := m.GetData(); 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)
- }
- }
- // QuerySpotgoodsPrice
- // @Summary 查询行情-现货列表
- // @Produce json
- // @Security ApiKeyAuth
- // @Param page query int false "页码"
- // @Param pagesize query int false "每页条数"
- // @Success 200 {array} models.Spotgoodsprice
- // @Failure 500 {object} app.Response
- // @Router /Ferroalloy/QuerySpotgoodsPrice [get]
- // @Tags 铁合金
- func QuerySpotgoodsPrice(c *gin.Context) {
- a := app.GinUtils{Gin: app.Gin{C: c}}
- m := models.Spotgoodsprice{}
- a.DoBindReq(&m)
- a.DoGetDataByPage(&m)
- }
- // QueryThjSpotQuoteConfig
- // @Summary 查询现货行情配置表
- // @Produce json
- // @Success 200 {array} models.Thjspotquoteconfig
- // @Failure 500 {object} app.Response
- // @Router /Ferroalloy/QueryThjSpotQuoteConfig [get]
- // @Tags 铁合金
- func QueryThjSpotQuoteConfig(c *gin.Context) {
- a := app.GinUtils{Gin: app.Gin{C: c}}
- m := models.Thjspotquoteconfig{}
- a.DoBindReq(&m)
- a.DoGetDataEx(&m)
- }
|