Quellcode durchsuchen

增加“定制【海商报业】 - 查询二级市场(挂牌点选)商品信息详情”接口

zhou.xiaoning vor 5 Jahren
Ursprung
Commit
0bb4775675
7 geänderte Dateien mit 527 neuen und 155 gelöschten Zeilen
  1. 43 4
      controllers/hsby/hsby.go
  2. 153 52
      docs/docs.go
  3. 153 52
      docs/swagger.json
  4. 109 39
      docs/swagger.yaml
  5. 0 3
      main.go
  6. 66 4
      models/hsby.go
  7. 3 1
      routers/router.go

+ 43 - 4
controllers/hsby/hsby.go

@@ -19,8 +19,8 @@ type QueryTopGoodsReq struct {
 	DescCityID     int `form:"descCityID"`
 }
 
-// QueryTopGoods 查询热门商品列表
-// @Summary 查询热门商品列表
+// QueryTopGoods 查询热门商品列表(二级市场,挂牌点选)
+// @Summary 查询热门商品列表(二级市场,挂牌点选)
 // @Description 说明:查询结果已按Hotindex(景点热度)从大到小排序
 // @Produce json
 // @Security ApiKeyAuth
@@ -29,7 +29,7 @@ type QueryTopGoodsReq struct {
 // @Param marketID query int true "市场ID"
 // @Param DescProvinceID query int false "目的地(省)ID"
 // @Param DescCityID query int false "目的地(市)ID"
-// @Success 200 {object} models.TopGoods
+// @Success 200 {object} models.HsbyTopGoods
 // @Failure 500 {object} app.Response
 // @Router /HSBY/QueryTopGoods [get]
 // @Tags 定制【海商报业】
@@ -61,7 +61,7 @@ func QueryTopGoods(c *gin.Context) {
 	// 分页
 	total := len(topGoodses)
 	if req.PageSize > 0 {
-		rstByPage := make([]models.TopGoods, 0)
+		rstByPage := make([]models.HsbyTopGoods, 0)
 		// 开始上标
 		start := req.Page * req.PageSize
 		// 结束下标
@@ -89,3 +89,42 @@ func QueryTopGoods(c *gin.Context) {
 		appG.Response(http.StatusOK, e.SUCCESS, topGoodses)
 	}
 }
+
+// QueryHsbyListingGoodsDetailReq 查询二级市场(挂牌点选)商品信息详情请求参数
+type QueryHsbyListingGoodsDetailReq struct {
+	GoodsID int `form:"goodsID" binding:"required"`
+}
+
+// QueryHsbyListingGoodsDetail 查询二级市场(挂牌点选)商品信息详情
+// @Summary 查询二级市场(挂牌点选)商品信息详情
+// @Produce json
+// @Security ApiKeyAuth
+// @Param goodsID query int true "商品ID"
+// @Success 200 {object} models.HsbyListingGoodsDetail
+// @Failure 500 {object} app.Response
+// @Router /HSBY/QueryHsbyListingGoodsDetail [get]
+// @Tags 定制【海商报业】
+func QueryHsbyListingGoodsDetail(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	// 获取请求参数
+	var req QueryHsbyListingGoodsDetailReq
+	if err := appG.C.ShouldBindQuery(&req); err != nil {
+		logger.GetLogger().Errorf("QueryHsbyListingGoodsDetail failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	// 获取数据
+	goodsInfo, err := models.GetHsbyListingGoodsDetail(req.GoodsID)
+	if err != nil {
+		// 查询失败
+		logger.GetLogger().Errorf("QueryHsbyListingGoodsDetail failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+
+	// 查询成功返回
+	logger.GetLogger().Debugln("QueryHsbyListingGoodsDetail successed: %v", goodsInfo)
+	appG.Response(http.StatusOK, e.SUCCESS, goodsInfo)
+}

+ 153 - 52
docs/docs.go

@@ -723,6 +723,45 @@ var doc = `{
                 }
             }
         },
+        "/HSBY/QueryHsbyListingGoodsDetail": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "定制【海商报业】"
+                ],
+                "summary": "查询二级市场(挂牌点选)商品信息详情",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "商品ID",
+                        "name": "goodsID",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/models.HsbyListingGoodsDetail"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/HSBY/QueryTopGoods": {
             "get": {
                 "security": [
@@ -737,7 +776,7 @@ var doc = `{
                 "tags": [
                     "定制【海商报业】"
                 ],
-                "summary": "查询热门商品列表",
+                "summary": "查询热门商品列表(二级市场,挂牌点选)",
                 "parameters": [
                     {
                         "type": "integer",
@@ -775,7 +814,7 @@ var doc = `{
                     "200": {
                         "description": "OK",
                         "schema": {
-                            "$ref": "#/definitions/models.TopGoods"
+                            "$ref": "#/definitions/models.HsbyTopGoods"
                         }
                     },
                     "500": {
@@ -3329,6 +3368,118 @@ var doc = `{
                 }
             }
         },
+        "models.HsbyListingGoodsDetail": {
+            "type": "object",
+            "required": [
+                "goodscode",
+                "goodsid",
+                "goodsname"
+            ],
+            "properties": {
+                "currency": {
+                    "description": "货币",
+                    "type": "string"
+                },
+                "currencysign": {
+                    "description": "货币符号",
+                    "type": "string"
+                },
+                "decimalplace": {
+                    "description": "报价小数位",
+                    "type": "integer"
+                },
+                "desccityid": {
+                    "description": "目的地(市)ID",
+                    "type": "integer"
+                },
+                "descprovinceid": {
+                    "description": "目的地(省)ID",
+                    "type": "integer"
+                },
+                "goodscode": {
+                    "description": "商品代码(内部)",
+                    "type": "string"
+                },
+                "goodsdesc": {
+                    "description": "商品详情",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "商品ID(自增ID SEQ_GOODS)",
+                    "type": "integer"
+                },
+                "goodsname": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "hotindex": {
+                    "description": "景点热度",
+                    "type": "integer"
+                },
+                "last": {
+                    "description": "现价",
+                    "type": "number"
+                },
+                "picurls": {
+                    "description": "介绍图片[多张用逗号分隔]",
+                    "type": "string"
+                },
+                "videourls": {
+                    "description": "介绍视频[多张用逗号分隔]",
+                    "type": "string"
+                }
+            }
+        },
+        "models.HsbyTopGoods": {
+            "type": "object",
+            "required": [
+                "goodscode",
+                "goodsid",
+                "goodsname"
+            ],
+            "properties": {
+                "currency": {
+                    "description": "货币",
+                    "type": "string"
+                },
+                "currencysign": {
+                    "description": "货币符号",
+                    "type": "string"
+                },
+                "decimalplace": {
+                    "description": "报价小数位",
+                    "type": "integer"
+                },
+                "goodscode": {
+                    "description": "商品代码(内部)",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "商品ID(自增ID SEQ_GOODS)",
+                    "type": "integer"
+                },
+                "goodsname": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "hotindex": {
+                    "description": "景点热度",
+                    "type": "integer"
+                },
+                "last": {
+                    "description": "现价",
+                    "type": "number"
+                },
+                "picurls": {
+                    "description": "介绍图片[多张用逗号分隔]",
+                    "type": "string"
+                },
+                "videourls": {
+                    "description": "介绍视频[多张用逗号分隔]",
+                    "type": "string"
+                }
+            }
+        },
         "models.OperationPrimaryMenu": {
             "type": "object",
             "properties": {
@@ -3616,56 +3767,6 @@ var doc = `{
                 }
             }
         },
-        "models.TopGoods": {
-            "type": "object",
-            "required": [
-                "goodscode",
-                "goodsid",
-                "goodsname"
-            ],
-            "properties": {
-                "currency": {
-                    "description": "货币",
-                    "type": "string"
-                },
-                "currencysign": {
-                    "description": "货币符号",
-                    "type": "string"
-                },
-                "decimalplace": {
-                    "description": "报价小数位",
-                    "type": "integer"
-                },
-                "goodscode": {
-                    "description": "商品代码(内部)",
-                    "type": "string"
-                },
-                "goodsid": {
-                    "description": "商品ID(自增ID SEQ_GOODS)",
-                    "type": "integer"
-                },
-                "goodsname": {
-                    "description": "商品名称",
-                    "type": "string"
-                },
-                "hotindex": {
-                    "description": "景点热度",
-                    "type": "integer"
-                },
-                "last": {
-                    "description": "现价",
-                    "type": "number"
-                },
-                "picurls": {
-                    "description": "介绍图片[多张用逗号分隔]",
-                    "type": "string"
-                },
-                "videourls": {
-                    "description": "介绍视频[多张用逗号分隔]",
-                    "type": "string"
-                }
-            }
-        },
         "models.Userinfo": {
             "type": "object",
             "required": [

+ 153 - 52
docs/swagger.json

@@ -707,6 +707,45 @@
                 }
             }
         },
+        "/HSBY/QueryHsbyListingGoodsDetail": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "定制【海商报业】"
+                ],
+                "summary": "查询二级市场(挂牌点选)商品信息详情",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "商品ID",
+                        "name": "goodsID",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/models.HsbyListingGoodsDetail"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/HSBY/QueryTopGoods": {
             "get": {
                 "security": [
@@ -721,7 +760,7 @@
                 "tags": [
                     "定制【海商报业】"
                 ],
-                "summary": "查询热门商品列表",
+                "summary": "查询热门商品列表(二级市场,挂牌点选)",
                 "parameters": [
                     {
                         "type": "integer",
@@ -759,7 +798,7 @@
                     "200": {
                         "description": "OK",
                         "schema": {
-                            "$ref": "#/definitions/models.TopGoods"
+                            "$ref": "#/definitions/models.HsbyTopGoods"
                         }
                     },
                     "500": {
@@ -3313,6 +3352,118 @@
                 }
             }
         },
+        "models.HsbyListingGoodsDetail": {
+            "type": "object",
+            "required": [
+                "goodscode",
+                "goodsid",
+                "goodsname"
+            ],
+            "properties": {
+                "currency": {
+                    "description": "货币",
+                    "type": "string"
+                },
+                "currencysign": {
+                    "description": "货币符号",
+                    "type": "string"
+                },
+                "decimalplace": {
+                    "description": "报价小数位",
+                    "type": "integer"
+                },
+                "desccityid": {
+                    "description": "目的地(市)ID",
+                    "type": "integer"
+                },
+                "descprovinceid": {
+                    "description": "目的地(省)ID",
+                    "type": "integer"
+                },
+                "goodscode": {
+                    "description": "商品代码(内部)",
+                    "type": "string"
+                },
+                "goodsdesc": {
+                    "description": "商品详情",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "商品ID(自增ID SEQ_GOODS)",
+                    "type": "integer"
+                },
+                "goodsname": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "hotindex": {
+                    "description": "景点热度",
+                    "type": "integer"
+                },
+                "last": {
+                    "description": "现价",
+                    "type": "number"
+                },
+                "picurls": {
+                    "description": "介绍图片[多张用逗号分隔]",
+                    "type": "string"
+                },
+                "videourls": {
+                    "description": "介绍视频[多张用逗号分隔]",
+                    "type": "string"
+                }
+            }
+        },
+        "models.HsbyTopGoods": {
+            "type": "object",
+            "required": [
+                "goodscode",
+                "goodsid",
+                "goodsname"
+            ],
+            "properties": {
+                "currency": {
+                    "description": "货币",
+                    "type": "string"
+                },
+                "currencysign": {
+                    "description": "货币符号",
+                    "type": "string"
+                },
+                "decimalplace": {
+                    "description": "报价小数位",
+                    "type": "integer"
+                },
+                "goodscode": {
+                    "description": "商品代码(内部)",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "商品ID(自增ID SEQ_GOODS)",
+                    "type": "integer"
+                },
+                "goodsname": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "hotindex": {
+                    "description": "景点热度",
+                    "type": "integer"
+                },
+                "last": {
+                    "description": "现价",
+                    "type": "number"
+                },
+                "picurls": {
+                    "description": "介绍图片[多张用逗号分隔]",
+                    "type": "string"
+                },
+                "videourls": {
+                    "description": "介绍视频[多张用逗号分隔]",
+                    "type": "string"
+                }
+            }
+        },
         "models.OperationPrimaryMenu": {
             "type": "object",
             "properties": {
@@ -3600,56 +3751,6 @@
                 }
             }
         },
-        "models.TopGoods": {
-            "type": "object",
-            "required": [
-                "goodscode",
-                "goodsid",
-                "goodsname"
-            ],
-            "properties": {
-                "currency": {
-                    "description": "货币",
-                    "type": "string"
-                },
-                "currencysign": {
-                    "description": "货币符号",
-                    "type": "string"
-                },
-                "decimalplace": {
-                    "description": "报价小数位",
-                    "type": "integer"
-                },
-                "goodscode": {
-                    "description": "商品代码(内部)",
-                    "type": "string"
-                },
-                "goodsid": {
-                    "description": "商品ID(自增ID SEQ_GOODS)",
-                    "type": "integer"
-                },
-                "goodsname": {
-                    "description": "商品名称",
-                    "type": "string"
-                },
-                "hotindex": {
-                    "description": "景点热度",
-                    "type": "integer"
-                },
-                "last": {
-                    "description": "现价",
-                    "type": "number"
-                },
-                "picurls": {
-                    "description": "介绍图片[多张用逗号分隔]",
-                    "type": "string"
-                },
-                "videourls": {
-                    "description": "介绍视频[多张用逗号分隔]",
-                    "type": "string"
-                }
-            }
-        },
         "models.Userinfo": {
             "type": "object",
             "required": [

+ 109 - 39
docs/swagger.yaml

@@ -1189,6 +1189,89 @@ definitions:
     required:
     - spotcontractid
     type: object
+  models.HsbyListingGoodsDetail:
+    properties:
+      currency:
+        description: 货币
+        type: string
+      currencysign:
+        description: 货币符号
+        type: string
+      decimalplace:
+        description: 报价小数位
+        type: integer
+      desccityid:
+        description: 目的地(市)ID
+        type: integer
+      descprovinceid:
+        description: 目的地(省)ID
+        type: integer
+      goodscode:
+        description: 商品代码(内部)
+        type: string
+      goodsdesc:
+        description: 商品详情
+        type: string
+      goodsid:
+        description: 商品ID(自增ID SEQ_GOODS)
+        type: integer
+      goodsname:
+        description: 商品名称
+        type: string
+      hotindex:
+        description: 景点热度
+        type: integer
+      last:
+        description: 现价
+        type: number
+      picurls:
+        description: 介绍图片[多张用逗号分隔]
+        type: string
+      videourls:
+        description: 介绍视频[多张用逗号分隔]
+        type: string
+    required:
+    - goodscode
+    - goodsid
+    - goodsname
+    type: object
+  models.HsbyTopGoods:
+    properties:
+      currency:
+        description: 货币
+        type: string
+      currencysign:
+        description: 货币符号
+        type: string
+      decimalplace:
+        description: 报价小数位
+        type: integer
+      goodscode:
+        description: 商品代码(内部)
+        type: string
+      goodsid:
+        description: 商品ID(自增ID SEQ_GOODS)
+        type: integer
+      goodsname:
+        description: 商品名称
+        type: string
+      hotindex:
+        description: 景点热度
+        type: integer
+      last:
+        description: 现价
+        type: number
+      picurls:
+        description: 介绍图片[多张用逗号分隔]
+        type: string
+      videourls:
+        description: 介绍视频[多张用逗号分隔]
+        type: string
+    required:
+    - goodscode
+    - goodsid
+    - goodsname
+    type: object
   models.OperationPrimaryMenu:
     properties:
       Children:
@@ -1398,43 +1481,6 @@ definitions:
     required:
     - autoid
     type: object
-  models.TopGoods:
-    properties:
-      currency:
-        description: 货币
-        type: string
-      currencysign:
-        description: 货币符号
-        type: string
-      decimalplace:
-        description: 报价小数位
-        type: integer
-      goodscode:
-        description: 商品代码(内部)
-        type: string
-      goodsid:
-        description: 商品ID(自增ID SEQ_GOODS)
-        type: integer
-      goodsname:
-        description: 商品名称
-        type: string
-      hotindex:
-        description: 景点热度
-        type: integer
-      last:
-        description: 现价
-        type: number
-      picurls:
-        description: 介绍图片[多张用逗号分隔]
-        type: string
-      videourls:
-        description: 介绍视频[多张用逗号分隔]
-        type: string
-    required:
-    - goodscode
-    - goodsid
-    - goodsname
-    type: object
   models.Userinfo:
     properties:
       address:
@@ -3360,6 +3406,30 @@ paths:
       summary: 查询现货合同表信息(指定策略ID、未结束的)
       tags:
       - 风险管理
+  /HSBY/QueryHsbyListingGoodsDetail:
+    get:
+      parameters:
+      - description: 商品ID
+        in: query
+        name: goodsID
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/models.HsbyListingGoodsDetail'
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询二级市场(挂牌点选)商品信息详情
+      tags:
+      - 定制【海商报业】
   /HSBY/QueryTopGoods:
     get:
       description: 说明:查询结果已按Hotindex(景点热度)从大到小排序
@@ -3391,14 +3461,14 @@ paths:
         "200":
           description: OK
           schema:
-            $ref: '#/definitions/models.TopGoods'
+            $ref: '#/definitions/models.HsbyTopGoods'
         "500":
           description: Internal Server Error
           schema:
             $ref: '#/definitions/app.Response'
       security:
       - ApiKeyAuth: []
-      summary: 查询热门商品列表
+      summary: 查询热门商品列表(二级市场,挂牌点选)
       tags:
       - 定制【海商报业】
   /History/QueryTSData:

+ 0 - 3
main.go

@@ -11,7 +11,6 @@ import (
 	"mtp2_if/config"
 	"mtp2_if/db"
 	"mtp2_if/logger"
-	"mtp2_if/models"
 	"mtp2_if/rediscli"
 	"mtp2_if/routers"
 
@@ -70,8 +69,6 @@ func main() {
 	}
 	defer db.CloseMySQL()
 
-	models.GetHsbyTopGoods(16201, 0, 0)
-
 	// 初始化Redis客户端
 	err = rediscli.InitRedisCli()
 	if err != nil {

+ 66 - 4
models/hsby.go

@@ -28,8 +28,8 @@ func (Hsbygoodsex) TableName() string {
 	return "HSBY_GOODSEX"
 }
 
-// TopGoods 热门商品列表
-type TopGoods struct {
+// HsbyTopGoods 热门商品列表
+type HsbyTopGoods struct {
 	Goodsid      int64  `json:"goodsid"  xorm:"'GOODSID'" binding:"required"`     // 商品ID(自增ID SEQ_GOODS)
 	Goodscode    string `json:"goodscode"  xorm:"'GOODSCODE'" binding:"required"` // 商品代码(内部)
 	Goodsname    string `json:"goodsname"  xorm:"'GOODSNAME'" binding:"required"` // 商品名称
@@ -51,10 +51,12 @@ type TopGoods struct {
 // 参数 descCityID int 目标城市ID
 // 返回 []TopGoods 热门商品列表
 // 返回 error error
-func GetHsbyTopGoods(marketID int, descProvinceID int, descCityID int) ([]TopGoods, error) {
+func GetHsbyTopGoods(marketID int, descProvinceID int, descCityID int) ([]HsbyTopGoods, error) {
+	// 热门商品为二级市场(挂牌点选)下的商品信息
+
 	engine := db.GetEngine()
 
-	topGoodses := make([]TopGoods, 0)
+	topGoodses := make([]HsbyTopGoods, 0)
 	// 获取挂牌商品信息,以及扩展表信息
 	session := engine.Table("GOODS").
 		Select(`GOODS.*, 
@@ -106,3 +108,63 @@ func GetHsbyTopGoods(marketID int, descProvinceID int, descCityID int) ([]TopGoo
 
 	return topGoodses, nil
 }
+
+// HsbyListingGoodsDetail 二级市场(挂牌点选)商品信息详情
+type HsbyListingGoodsDetail struct {
+	Goodsid      int64  `json:"goodsid"  xorm:"'GOODSID'" binding:"required"`     // 商品ID(自增ID SEQ_GOODS)
+	Goodscode    string `json:"goodscode"  xorm:"'GOODSCODE'" binding:"required"` // 商品代码(内部)
+	Goodsname    string `json:"goodsname"  xorm:"'GOODSNAME'" binding:"required"` // 商品名称
+	Decimalplace int64  `json:"decimalplace"  xorm:"'DECIMALPLACE'"`              // 报价小数位
+
+	Hotindex       int32  `json:"hotindex"  xorm:"'HOTINDEX'"`             // 景点热度
+	Videourls      string `json:"videourls"  xorm:"'VIDEOURLS'"`           // 介绍视频[多张用逗号分隔]
+	Picurls        string `json:"picurls"  xorm:"'PICURLS'"`               // 介绍图片[多张用逗号分隔]
+	Descprovinceid int64  `json:"descprovinceid"  xorm:"'DESCPROVINCEID'"` // 目的地(省)ID
+	Desccityid     int64  `json:"desccityid"  xorm:"'DESCCITYID'"`         // 目的地(市)ID
+	Goodsdesc      string `json:"goodsdesc"  xorm:"'GOODSDESC'"`           // 商品详情
+
+	Currency     string `json:"currency" xorm:"'CURRENCY'"`         // 货币
+	Currencysign string `json:"currencysign" xorm:"'CURRENCYSIGN'"` // 货币符号
+
+	Last float64 `json:"last" xorm:"-"` // 现价
+}
+
+// GetHsbyListingGoodsDetail 获取二级市场(挂牌点选)商品信息详情
+// 参数 goodsID int 目标商品ID
+// 返回 *HsbyListingGoodsDetail 二级市场(挂牌点选)商品信息详情,查询无结果返回nil
+// 返回 error error
+func GetHsbyListingGoodsDetail(goodsID int) (*HsbyListingGoodsDetail, error) {
+	engine := db.GetEngine()
+
+	details := make([]HsbyListingGoodsDetail, 0)
+	// 获取挂牌商品信息,以及扩展表信息
+	// FIXME: - 这里使用Get方法,会造成SQL语句的嵌套出错,后期再研究
+	session := engine.Table("GOODS").
+		Select(`GOODS.GOODSID, GOODS.GOODSCODE, GOODS.GOODSNAME, GOODS.DECIMALPLACE,
+				HSBY_GOODSEX.HOTINDEX, HSBY_GOODSEX.VIDEOURLS, HSBY_GOODSEX.PICURLS, HSBY_GOODSEX.DESCPROVINCEID, HSBY_GOODSEX.Desccityid, HSBY_GOODSEX.Goodsdesc,
+				ENUMDICITEM.ENUMDICNAME CURRENCY, ENUMDICITEM.PARAM2 CURRENCYSIGN`).
+		Join("LEFT", "HSBY_GOODSEX", "HSBY_GOODSEX.GOODSID = GOODS.GOODSID").
+		Join("LEFT", "ENUMDICITEM", "ENUMDICITEM.ENUMITEMNAME = GOODS.CURRENCYID and ENUMDICITEM.ENUMDICCODE = 'currency'").
+		Where("GOODS.GOODSID = ?", goodsID)
+	if err := session.Find(&details); err != nil {
+		return nil, err
+	}
+	// 无目标商品
+	if len(details) == 0 {
+		return nil, nil
+	}
+	hsbyListingGoodsDetail := details[0]
+
+	// 获取商品现价
+	quoteDays, err := GetQuoteDays(hsbyListingGoodsDetail.Goodscode)
+	if err != nil {
+		return nil, err
+	}
+	if len(quoteDays) > 0 {
+		if quoteDays[0].Last != 0 {
+			hsbyListingGoodsDetail.Last = utils.IntToFloat64(int(quoteDays[0].Last), int(hsbyListingGoodsDetail.Decimalplace))
+		}
+	}
+
+	return &hsbyListingGoodsDetail, nil
+}

+ 3 - 1
routers/router.go

@@ -160,8 +160,10 @@ func InitRouter() *gin.Engine {
 	hsbyR := apiR.Group("HSBY")
 	hsbyR.Use(token.Auth())
 	{
-		// 查询热门商品列表
+		// 查询热门商品列表(二级市场,挂牌点选)
 		hsbyR.GET("/QueryTopGoods", hsby.QueryTopGoods)
+		// 查询二级市场(挂牌点选)商品信息详情
+		hsbyR.GET("/QueryHsbyListingGoodsDetail", hsby.QueryHsbyListingGoodsDetail)
 	}
 
 	return r