Explorar el Código

增加接口:
1、获取产品介绍列表;
2、获取我的推广-交易数据。

zhou.xiaoning hace 3 años
padre
commit
800c3142cf
Se han modificado 7 ficheros con 1697 adiciones y 1935 borrados
  1. 22 3
      controllers/ferroalloy/quote.go
  2. 19 0
      controllers/ferroalloy/trade.go
  3. 405 214
      docs/docs.go
  4. 405 214
      docs/swagger.json
  5. 736 1504
      docs/swagger.yaml
  6. 108 0
      models/ferroalloy.go
  7. 2 0
      routers/router.go

+ 22 - 3
controllers/ferroalloy/quote.go

@@ -11,10 +11,10 @@ import (
 // @Summary  获取现货行情
 // @Produce  json
 // @Security ApiKeyAuth
-// @Param    page     query    int false "页码"
-// @Param    pagesize query    int false "每页条数"
+// @Param    page         query    int  false "页码"
+// @Param    pagesize     query    int  false "每页条数"
 // @Success  200      {array}  models.GErmcpspotgoodsprice
-// @Failure  500      {object} app.Response
+// @Failure  500          {object} app.Response
 // @Router   /Ferroalloy/GetSpotGoodsPrice [get]
 // @Tags     铁合金
 func GetSpotGoodsPrice(c *gin.Context) {
@@ -23,3 +23,22 @@ func GetSpotGoodsPrice(c *gin.Context) {
 	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)
+}

+ 19 - 0
controllers/ferroalloy/trade.go

@@ -71,3 +71,22 @@ func QueryTHJPurchaseTradeDetail(c *gin.Context) {
 	a.DoBindReq(&m)
 	a.DoGetDataByPage(&m)
 }
+
+// QueryTHJTradeData
+// @Summary  获取我的推广-交易数据
+// @Produce  json
+// @Security ApiKeyAuth
+// @Param    userid   query    int true  "用户ID"
+// @Param    marketid query    int true  "市场ID 采购-64201 供求-65201"
+// @Param    page     query    int false "页码"
+// @Param    pagesize query    int false "每页条数"
+// @Success  200      {array}  models.THJTradeData
+// @Failure  500      {object} app.Response
+// @Router   /Ferroalloy/QueryTHJTradeData [get]
+// @Tags     铁合金
+func QueryTHJTradeData(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.THJTradeData{}
+	a.DoBindReq(&m)
+	a.DoGetDataByPage(&m)
+}

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 405 - 214
docs/docs.go


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 405 - 214
docs/swagger.json


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 736 - 1504
docs/swagger.yaml


+ 108 - 0
models/ferroalloy.go

@@ -847,3 +847,111 @@ func (r *ThjscoreconfigReq) Get() (data []Thjscoreconfig, err error) {
 
 	return
 }
+
+type THJProduct struct {
+	WRSTANDARDID   string `json:"wrstandardid" xorm:"WRSTANDARDID"`     // 现货商品ID(自增 SEQ_GOODS 确保不重复)
+	WRSTANDARDCODE string `json:"wrstandardcode" xorm:"WRSTANDARDCODE"` // 现货商品代码
+	WRSTANDARDNAME string `json:"wrstandardname" xorm:"WRSTANDARDNAME"` // 现货商品名称
+	BANNERPICURL   string `json:"bannerpicurl" xorm:"BANNERPICURL"`     // Banner图(逗号分隔)
+	PICTUREURLS    string `json:"pictureurls" xorm:"PICTUREURLS"`       // 详情图片(逗号分隔)
+
+	UserID       int  `json:"-" xorm:"-" form:"userid" binding:"required"` // 用户ID
+	FavoriteFlag bool `json:"-" xorm:"-" form:"favoriteflag"`              // 关注标志 true-已关注 false-未关注
+
+	PageEx `xorm:"extends"` // 页码信息
+}
+
+func (r *THJProduct) calc() {
+
+}
+
+func (r *THJProduct) buildSql() string {
+	var sqlId utils.SQLVal = `
+	select 
+		to_char(t.WRSTANDARDID) WRSTANDARDID, 
+		t.WRSTANDARDNAME, 
+		t.BANNERPICURL, 
+		t.PICTUREURLS 
+	from wrstandard t
+	where t.IsValid = 1 
+		and t.wrstandardid 
+		%v  
+		(select t.goodsid from UserFavoriteGoods t where t.userid = %v)
+`
+	param := "not in"
+	if r.FavoriteFlag {
+		param = "in"
+	}
+	sqlId.FormatParam(param, r.UserID)
+
+	sqlId.Page(r.Page, r.PageSize)
+	return sqlId.String()
+}
+
+func (r *THJProduct) GetDataByPage() (interface{}, error, int, int, int) {
+	sData := make([]THJProduct, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	total := 0
+	for i := range sData {
+		sData[i].calc()
+		total = sData[i].Total
+	}
+	return sData, err, r.Page, r.PageSize, total
+}
+
+type THJTradeData struct {
+	RECKONDATE   string  `json:"reckondate" xorm:"RECKONDATE"`                                // 日照日期(yyyyMMdd)日照日期(yyyyMMdd)
+	MARKETID     int64   `json:"marketid" xorm:"MARKETID" form:"marketid" binding:"required"` // 市场ID 采购-64201 供求-65201
+	BUYTRADELOT  int32   `json:"buytradelot" xorm:"BUYTRADELOT"`                              // 购买笔数
+	BUYTRADEQTY  float64 `json:"buytradeqty" xorm:"BUYTRADEQTY"`                              // 购买数量
+	SELLTRADELOT int32   `json:"selltradelot" xorm:"SELLTRADELOT"`                            // 销售笔数
+	SELLTRADEQTY float64 `json:"selltradeqty" xorm:"SELLTRADEQTY"`                            // 销售数量
+	USERID       int64   `json:"userid" xorm:"USERID" form:"userid" binding:"required"`       // 用户ID
+
+	WRSTANDARDNAME string `json:"wrstandardname" xorm:"WRSTANDARDNAME"` // 现货商品名称
+
+	PageEx `xorm:"extends"` // 页码信息
+}
+
+func (r *THJTradeData) calc() {
+
+}
+
+func (r *THJTradeData) buildSql() string {
+	var sqlId utils.SQLVal = `
+	select 
+		a.*
+  	from 
+		(select 
+			to_char(to_date(t.reckondate, 'yyyymmdd'), 'yyyy-mm-dd') RECKONDATE,
+			wr.WRSTANDARDNAME,
+			t.BUYTRADEQTY, 
+			t.BUYTRADELOT,
+			t.SELLTRADEQTY,
+			t.SELLTRADELOT,
+			t.updatetime
+		from Reckon_WRTradeSum t
+		left join wrstandard wr on t.wrstandardid = wr.wrstandardid
+		left join useraccount ua on t.userid = ua.userid
+		where 
+			t.refereeuserid = %v 
+			and
+			t.marketid = %v) a
+ 	order by a.updatetime desc
+	`
+	sqlId.FormatParam(r.USERID, r.MARKETID)
+
+	sqlId.Page(r.Page, r.PageSize)
+	return sqlId.String()
+}
+
+func (r *THJTradeData) GetDataByPage() (interface{}, error, int, int, int) {
+	sData := make([]THJTradeData, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	total := 0
+	for i := range sData {
+		sData[i].calc()
+		total = sData[i].Total
+	}
+	return sData, err, r.Page, r.PageSize, total
+}

+ 2 - 0
routers/router.go

@@ -698,6 +698,8 @@ func InitRouter() *gin.Engine {
 		ferroalloyR.Use(token.Auth()).GET("QueryTHJWrstandardDetail", ferroalloy.QueryTHJWrstandardDetail)
 		ferroalloyR.Use(token.Auth()).GET("QueryTHJPurchaseTradeDetail", ferroalloy.QueryTHJPurchaseTradeDetail)
 		ferroalloyR.Use(token.Auth()).GET("QueryTHJScoreConfig", ferroalloy.QueryTHJScoreConfig)
+		ferroalloyR.Use(token.Auth()).GET("QueryTHJProduct", ferroalloy.QueryTHJProduct)
+		ferroalloyR.Use(token.Auth()).GET("QueryTHJTradeData", ferroalloy.QueryTHJTradeData)
 	}
 
 	return r

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio