浏览代码

接口 /sbyj/GetMyOrders 增加 THUMURLS 出参

zhouxnsz 1 年之前
父节点
当前提交
e1e39688f8
共有 6 个文件被更改,包括 26 次插入6 次删除
  1. 4 4
      controllers/guangzuan/tradeService.go
  2. 4 0
      docs/docs.go
  3. 4 0
      docs/swagger.json
  4. 3 0
      docs/swagger.yaml
  5. 6 0
      models/sbyj.go
  6. 5 2
      mtpcache/goods.go

+ 4 - 4
controllers/guangzuan/tradeService.go

@@ -18,8 +18,8 @@ import (
 // @Security Group
 // @Param    userid   query    int    true  "用户ID"
 // @Param    executestatus query    int false "执行状态 - 1:未生效 2:进行中 3:已结束"
-// @Param    page          query    int false "页码"
-// @Param    pagesize      query    int false "每页条数"
+// @Param    page     query    int    false "页码"
+// @Param    pagesize query    int    false "每页条数"
 // @Success  200           {array}  models.GzcjjcorderM
 // @Failure  500     {object} app.Response
 // @Router   /Guangzuan/QueryGZCJJCOrder [get]
@@ -39,8 +39,8 @@ func QueryGZCJJCOrder(c *gin.Context) {
 // @Security Group
 // @Param    userid        query    int true  "用户ID"
 // @Param    orderid  query    string false "单据ID"
-// @Param    page     query    int    false "页码"
-// @Param    pagesize query    int    false "每页条数"
+// @Param    page          query    int false "页码"
+// @Param    pagesize      query    int false "每页条数"
 // @Success  200      {array}  models.GzcjjcorderdetailM
 // @Failure  500           {object} app.Response
 // @Router   /Guangzuan/QueryGZCJJCOrderDetail [get]

+ 4 - 0
docs/docs.go

@@ -52682,6 +52682,10 @@ const docTemplate = `{
                 "tHDetailEx": {
                     "description": "交易持仓扩展表记录",
                     "$ref": "#/definitions/models.TradeHolderDetailEx"
+                },
+                "thumurls": {
+                    "description": "缩略图片(1:1)(逗号分隔)",
+                    "type": "string"
                 }
             }
         },

+ 4 - 0
docs/swagger.json

@@ -52673,6 +52673,10 @@
                 "tHDetailEx": {
                     "description": "交易持仓扩展表记录",
                     "$ref": "#/definitions/models.TradeHolderDetailEx"
+                },
+                "thumurls": {
+                    "description": "缩略图片(1:1)(逗号分隔)",
+                    "type": "string"
                 }
             }
         },

+ 3 - 0
docs/swagger.yaml

@@ -21542,6 +21542,9 @@ definitions:
       tHDetailEx:
         $ref: '#/definitions/models.TradeHolderDetailEx'
         description: 交易持仓扩展表记录
+      thumurls:
+        description: 缩略图片(1:1)(逗号分隔)
+        type: string
     type: object
   models.RegisterMoney:
     properties:

+ 6 - 0
models/sbyj.go

@@ -138,6 +138,7 @@ type RedisTradeHolderDetailEx struct {
 	QuoteMinUnit      uint32              `json:"quoteMinUnit"`      // 行情最小变动单位
 
 	GoodsUnit string `json:"goodsUnit"` // 单位名称
+	THUMURLS  string `json:"thumurls"`  // 缩略图片(1:1)(逗号分隔)
 }
 
 type RedisTradeHolderDetailExArray []RedisTradeHolderDetailEx
@@ -244,6 +245,11 @@ func (r *RedisTradeHolderDetailEx) ParseFromProto(p *pb.RedisTradeHolderDetailEx
 	r.GoodsUnit = mtpcache.GetEnumDicitemName(int32(r.GoodsUnitID))
 
 	r.THDetailEx.TradeTime = strings.Replace(r.THDetailEx.TradeTime, "\n\u0013", "", -1)
+
+	// 获取对应的商品信息
+	if goods, bFind := mtpcache.GetGoods(r.GoodsCode); bFind {
+		r.THUMURLS = goods.THUMURLS
+	}
 }
 
 type MyTradegoodsdeliveryoffline struct {

+ 5 - 2
mtpcache/goods.go

@@ -8,11 +8,12 @@
 package mtpcache
 
 import (
-	"github.com/muesli/cache2go"
 	"mtp2_if/db"
 	"mtp2_if/utils"
 	"strings"
 	"time"
+
+	"github.com/muesli/cache2go"
 )
 
 var goodsCache *cache2go.CacheTable
@@ -66,6 +67,7 @@ type Goods struct {
 	GOODSCURRENCYID int32   `json:"goodscurrencyid"  xorm:"'GOODSCURRENCYID'"` // 合约货币ID
 	REFGOODSID      int64   `json:"refgoodsid"  xorm:"'REFGOODSID'"`           // 参考商品ID
 	REFGOODSCODE    string  `json:"refgoodscode"  xorm:"'REFGOODSCODE'"`       // 参考商品代码
+	THUMURLS        string  `json:"thumurls" xorm:"THUMURLS"`                  // 缩略图片(1:1)(逗号分隔)
 }
 
 func (r *Goods) Key() string {
@@ -92,7 +94,8 @@ select t.goodsid,
         t.goodscurrencyid,
         t.goodsquotetype,
         t.refgoodsid,
-        t.refgoodscode
+        t.refgoodscode,
+		t.thumurls
  from goods t
  where 1=1
 `