Browse Source

修改查询特卖商品列表(三级商城)接口

zhou.xiaoning 4 năm trước cách đây
mục cha
commit
a5c3025ffb
6 tập tin đã thay đổi với 67 bổ sung9 xóa
  1. 1 1
      controllers/hsby/hsby.go
  2. 13 1
      docs/docs.go
  3. 13 1
      docs/swagger.json
  4. 10 1
      docs/swagger.yaml
  5. 17 1
      models/account.go
  6. 13 4
      models/hsby.go

+ 1 - 1
controllers/hsby/hsby.go

@@ -1130,7 +1130,7 @@ type QueryMyCouponsReq struct {
 // @Produce json
 // @Security ApiKeyAuth
 // @Param accountIDs query string true "资金账户列表,格式:1,2,3"
-// @Param goodsID query int false "商品ID, 一般与sellOrderID配套传入"
+// @Param goodsID query int false "商品ID, 一般与sellUserID配套传入"
 // @Param sellUserID query int false "卖方UserID"
 // @Success 200 {object} models.MyCoupon
 // @Failure 500 {object} app.Response

+ 13 - 1
docs/docs.go

@@ -2081,7 +2081,7 @@ var doc = `{
                     },
                     {
                         "type": "integer",
-                        "description": "商品ID, 一般与sellOrderID配套传入",
+                        "description": "商品ID, 一般与sellUserID配套传入",
                         "name": "goodsID",
                         "in": "query"
                     },
@@ -6902,6 +6902,10 @@ var doc = `{
                     "description": "货币符号",
                     "type": "string"
                 },
+                "customername": {
+                    "description": "卖家名称",
+                    "type": "string"
+                },
                 "decimalplace": {
                     "description": "报价小数位",
                     "type": "integer"
@@ -6910,6 +6914,10 @@ var doc = `{
                     "description": "商品代码(内部)",
                     "type": "string"
                 },
+                "goodsdesc": {
+                    "description": "商品详情",
+                    "type": "string"
+                },
                 "goodsid": {
                     "description": "商品ID",
                     "type": "integer"
@@ -6966,6 +6974,10 @@ var doc = `{
                     "description": "成交数量",
                     "type": "integer"
                 },
+                "vendorname": {
+                    "description": "供应商名称",
+                    "type": "string"
+                },
                 "videourls": {
                     "description": "介绍视频[多张用逗号分隔]",
                     "type": "string"

+ 13 - 1
docs/swagger.json

@@ -2065,7 +2065,7 @@
                     },
                     {
                         "type": "integer",
-                        "description": "商品ID, 一般与sellOrderID配套传入",
+                        "description": "商品ID, 一般与sellUserID配套传入",
                         "name": "goodsID",
                         "in": "query"
                     },
@@ -6886,6 +6886,10 @@
                     "description": "货币符号",
                     "type": "string"
                 },
+                "customername": {
+                    "description": "卖家名称",
+                    "type": "string"
+                },
                 "decimalplace": {
                     "description": "报价小数位",
                     "type": "integer"
@@ -6894,6 +6898,10 @@
                     "description": "商品代码(内部)",
                     "type": "string"
                 },
+                "goodsdesc": {
+                    "description": "商品详情",
+                    "type": "string"
+                },
                 "goodsid": {
                     "description": "商品ID",
                     "type": "integer"
@@ -6950,6 +6958,10 @@
                     "description": "成交数量",
                     "type": "integer"
                 },
+                "vendorname": {
+                    "description": "供应商名称",
+                    "type": "string"
+                },
                 "videourls": {
                     "description": "介绍视频[多张用逗号分隔]",
                     "type": "string"

+ 10 - 1
docs/swagger.yaml

@@ -2415,12 +2415,18 @@ definitions:
       currencysign:
         description: 货币符号
         type: string
+      customername:
+        description: 卖家名称
+        type: string
       decimalplace:
         description: 报价小数位
         type: integer
       goodscode:
         description: 商品代码(内部)
         type: string
+      goodsdesc:
+        description: 商品详情
+        type: string
       goodsid:
         description: 商品ID
         type: integer
@@ -2466,6 +2472,9 @@ definitions:
       tradeqty:
         description: 成交数量
         type: integer
+      vendorname:
+        description: 供应商名称
+        type: string
       videourls:
         description: 介绍视频[多张用逗号分隔]
         type: string
@@ -6482,7 +6491,7 @@ paths:
         name: accountIDs
         required: true
         type: string
-      - description: 商品ID, 一般与sellOrderID配套传入
+      - description: 商品ID, 一般与sellUserID配套传入
         in: query
         name: goodsID
         type: integer

+ 17 - 1
models/account.go

@@ -535,7 +535,7 @@ func GetUserInfoByIDS(userids []int64) ([]Userinfo, error) {
 	return infos, err
 }
 
-// GetUserAccountByAccountID 通过资金账户获取户信息
+// GetUserAccountByAccountID 通过资金账户获取户信息
 func GetUserAccountByAccountID(accountID int) (*Useraccount, error) {
 	engine := db.GetEngine()
 	infos := make([]Useraccount, 0)
@@ -551,6 +551,22 @@ func GetUserAccountByAccountID(accountID int) (*Useraccount, error) {
 	return nil, nil
 }
 
+// GetUserInfoByAccountID 通过资金账户获取用户信息
+func GetUserInfoByAccountID(accountID int) (*Userinfo, error) {
+	engine := db.GetEngine()
+	infos := make([]Userinfo, 0)
+	if err := engine.Table("USERINFO U").
+		Join("INNER", "TAACCOUNT TA", "TA.RELATEDUSERID = U.USERID").
+		Where("TA.ACCOUNTID = ?", accountID).Find(&infos); err != nil {
+		return nil, err
+	}
+	if len(infos) > 0 {
+		return &infos[0], nil
+	}
+
+	return nil, nil
+}
+
 // GetUserFavoriteGoodses 获取用户商品收藏信息
 func GetUserFavoriteGoodses(userID int) ([]Userfavoritegoods, error) {
 	engine := db.GetEngine()

+ 13 - 4
models/hsby.go

@@ -1372,12 +1372,17 @@ type HsbyMarketGoods struct {
 	Videourls  string `json:"videourls"  xorm:"'VIDEOURLS'"`   // 介绍视频[多张用逗号分隔]
 	Picurls    string `json:"picurls"  xorm:"'PICURLS'"`       // 介绍图片[多张用逗号分隔]
 	Categoryid int32  `json:"categoryid"  xorm:"'CATEGORYID'"` // 类别ID(WRCATEGORY)
+	Goodsdesc  string `json:"goodsdesc"  xorm:"'GOODSDESC'"`   // 商品详情
 
 	Currency     string `json:"currency" xorm:"'CURRENCY'"`         // 货币
 	Currencysign string `json:"currencysign" xorm:"'CURRENCYSIGN'"` // 货币符号
 
 	Trademode int32 `json:"trademode"  xorm:"'TRADEMODE'" binding:"required"` // 交易模式 - 10:做市 13:竞价 15:通道交易 16:挂牌点选 17:仓单贸易 18:期权 19:竞拍-降价式 20:竞拍-竞价式 21:竞拍-大宗式 22:受托竞价
 
+	Vendorname string `json:"vendorname"  xorm:"'VENDORNAME'"` // 供应商名称
+
+	Customername string `json:"customername"  xorm:"'CUSTOMERNAME'"` // 卖家名称
+
 	HasCoupon bool `json:"hascoupon" xorm:"-"` // 是否可用优惠卷
 
 	SellUserID int `json:"sellUserID" xorm:"-"` // 卖方UserID
@@ -1392,13 +1397,15 @@ func GetHsbyMarketGoodses(marketIDs string, accountID, categoryID int) ([]HsbyMa
 	session := engine.Table("TRADE_ORDERDETAIL T").
 		Select(`to_char(T.ORDERID) ORDERIDSTR, T.*, 
 				G.GOODSCODE, G.GOODSNAME, G.DECIMALPLACE, G.QUOTEMINUNIT, G.AGREEUNIT, 
-				GX.HOTINDEX, GX.VIDEOURLS, GX.PICURLS, GX.CATEGORYID,  
+				GX.HOTINDEX, GX.VIDEOURLS, GX.PICURLS, GX.CATEGORYID, GX.GOODSDESC, 
 				ENUMDICITEM.ENUMDICNAME CURRENCY, ENUMDICITEM.PARAM2 CURRENCYSIGN, 
-				M.TRADEMODE`).
+				M.TRADEMODE, 
+				H.VENDORNAME`).
 		Join("LEFT", "GOODS G", "G.GOODSID = T.GOODSID").
 		Join("LEFT", "HSBY_GOODSEX GX", "GX.GOODSID = T.GOODSID").
 		Join("LEFT", "ENUMDICITEM E", "E.ENUMITEMNAME = G.CURRENCYID and E.ENUMDICCODE = 'currency'").
 		Join("LEFT", "MARKET M", "M.MARKETID = T.MARKETID").
+		Join("LEFT", "HSBY_SUPPLIERINFO H", "H.VENDORID = GX.VENDORID").
 		Where(fmt.Sprintf("T.MARKETID in (%s)", marketIDs)).
 		And("T.ORDERSTATUS in (3,7) and T.BUYORSELL = 1 and (T.ORDERQTY - T.TRADEQTY - T.CANCELQTY) > 0")
 	if categoryID != 0 {
@@ -1446,13 +1453,15 @@ func GetHsbyMarketGoodses(marketIDs string, accountID, categoryID int) ([]HsbyMa
 					order := &orders[i]
 
 					// 获取卖家UserID
-					userAccount, err := GetUserAccountByAccountID(int(order.Accountid))
+					userInfo, err := GetUserInfoByAccountID(int(order.Accountid))
 					if err != nil {
 						continue
 					}
+					order.SellUserID = int(userInfo.Userid)
+					order.Customername = userInfo.Customername
 
 					tmpGoodsID := fmt.Sprintf(",%d,", order.Goodsid)
-					tmpUserID := fmt.Sprintf(",%d,", userAccount.Userid)
+					tmpUserID := fmt.Sprintf(",%d,", userInfo.Userid)
 
 					// 优惠卷是否可用于商品
 					isRightGoods := false