فهرست منبع

修改海商接口BUG

zhou.xiaoning 4 سال پیش
والد
کامیت
b52d61db4c
5فایلهای تغییر یافته به همراه15 افزوده شده و 10 حذف شده
  1. 1 1
      docs/docs.go
  2. 1 1
      docs/swagger.json
  3. 1 1
      docs/swagger.yaml
  4. 1 1
      models/hsby.go
  5. 11 6
      models/wr.go

+ 1 - 1
docs/docs.go

@@ -8810,7 +8810,7 @@ var doc = `{
                     "description": "父类别ID",
                     "type": "integer"
                 },
-                "subCategory": {
+                "subcategory": {
                     "description": "子分类",
                     "type": "array",
                     "items": {

+ 1 - 1
docs/swagger.json

@@ -8794,7 +8794,7 @@
                     "description": "父类别ID",
                     "type": "integer"
                 },
-                "subCategory": {
+                "subcategory": {
                     "description": "子分类",
                     "type": "array",
                     "items": {

+ 1 - 1
docs/swagger.yaml

@@ -3808,7 +3808,7 @@ definitions:
       parentcategoryid:
         description: 父类别ID
         type: integer
-      subCategory:
+      subcategory:
         description: 子分类
         items:
           $ref: '#/definitions/models.WRCategoryTree'

+ 1 - 1
models/hsby.go

@@ -1534,7 +1534,7 @@ func GetHsbyMarketGoodsDetail(orderID int) (*HsbyMarketGoodsDetail, error) {
 		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.GOODSDESC, 
-				ENUMDICITEM.ENUMDICNAME CURRENCY, ENUMDICITEM.PARAM2 CURRENCYSIGN, 
+				E.ENUMDICNAME CURRENCY, E.PARAM2 CURRENCYSIGN, 
 				M.TRADEMODE, 
 				H.VENDORNAME,
 				U.USERID SELLUSERID, U.CUSTOMERNAME`).

+ 11 - 6
models/wr.go

@@ -38,7 +38,7 @@ type WRCategoryTree struct {
 	Orderindex       int32  `json:"orderindex"  xorm:"'ORDERINDEX'"`                    // 顺序
 	Areauserid       int64  `json:"areauserid"  xorm:"'AREAUSERID'"`                    // 所属机构
 
-	SubCategory []WRCategoryTree // 子分类
+	SubCategory []WRCategoryTree `json:"subcategory" xorm:"-"` // 子分类
 }
 
 // CreateCategoryTree 生成现货分类信息
@@ -46,17 +46,22 @@ func CreateCategoryTree(parentCategoryID int) ([]WRCategoryTree, error) {
 	engine := db.GetEngine()
 
 	wrCategoryTrees := make([]WRCategoryTree, 0)
-	if err := engine.Table("WRCATEGORY WR").
-		Where("WR.PARENTCATEGORYID = ?", parentCategoryID).
-		Asc("WR.ORDERINDEX").
-		Find(&wrCategoryTrees); err != nil {
+	session := engine.Table("WRCATEGORY WR")
+	if parentCategoryID != 0 {
+		session = session.Where("WR.PARENTCATEGORYID = ?", parentCategoryID)
+	} else {
+		session = session.Where("WR.PARENTCATEGORYID is null")
+	}
+	session = session.Asc("WR.ORDERINDEX")
+	if err := session.Find(&wrCategoryTrees); err != nil {
 		return nil, err
 	}
+
 	for i := range wrCategoryTrees {
 		category := &wrCategoryTrees[i]
 
 		// 递归生成子分类
-		subs, err := CreateCategoryTree(int(category.Parentcategoryid))
+		subs, err := CreateCategoryTree(int(category.Categoryid))
 		if err != nil {
 			return nil, err
 		}