From 9c76abd491d95ce9fdb68a8583f189eee8e0eb29 Mon Sep 17 00:00:00 2001 From: sian Date: Mon, 29 Aug 2022 17:24:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supplier/goods/sku.go | 71 ++++++++++++++++++++++++++++--------------- 1 file changed, 46 insertions(+), 25 deletions(-) diff --git a/supplier/goods/sku.go b/supplier/goods/sku.go index 05a800c..abc08a7 100644 --- a/supplier/goods/sku.go +++ b/supplier/goods/sku.go @@ -15,38 +15,59 @@ const ( type sku struct { } -type SkuSearch struct { - Name string // 商品名称 - SupplierSkuId uint64 // 京东SkuId - CategoryId uint64 // 类目id - BrandName string // 品牌 - MinSupplyPrice decimal.Decimal // 采购价最小 - MaxSupplyPrice decimal.Decimal // 采购价最大 - SupplierType uint // 供应商类型 -} -type ArgsSkuList struct { - Search SkuSearch +type GoodsSearch struct { + Name string // 商品名称 + CategoryId uint64 // 类目id + BrandName string // 品牌名 + SupplierType uint // 供应商类型 +} +type ArgsGoodsList struct { + Search GoodsSearch Page bean.Page } -type SkuItem struct { - Id uint `json:"id"` - Name string `json:"name"` - ImgUrl string `json:"imgUrl"` - FirstCategoryName string `json:"firstCategoryName"` - SecondCategoryName string `json:"secondCategoryName"` - ThirdCategoryName string `json:"thirdCategoryName"` - BrandName string `json:"brandName"` - SupplyPrice decimal.Decimal `json:"supplyPrice"` - GuidePrice decimal.Decimal `json:"guidePrice"` +type GoodsItem struct { + Id uint `json:"id"` + Name string `json:"name"` + Img string `json:"img"` + GoodsNum string `json:"goodsNum"` + CategoryId uint `json:"categoryId"` + Category string `json:"category"` + BrandId uint `json:"brandId"` + Brand string `json:"brand"` + GoodsSpecs []GoodsSpecificationItem `json:"goodsSpecs"` + SkuItems []GoodsItemLists `json:"skuItems"` + StockCount uint `json:"stockCount"` + MinPrice decimal.Decimal `json:"minPrice"` + CreatedAt int64 `json:"createdAt"` +} + +type GoodsItemLists struct { + Id uint `json:"id"` + Specifications []SkuSpecificationItem `json:"specifications"` + Stock uint `json:"stock"` + SupplyPrice decimal.Decimal `json:"supplyPrice"` + GoodsId uint `json:"goodsId"` + Img string `json:"img"` +} + +type GoodsSpecificationItem struct { + Name string `json:"name"` + Values []string `json:"values"` +} + +type SkuSpecificationItem struct { + Name string `json:"name"` + Value string `json:"value"` } -type ReplySkuList struct { - Lists []SkuItem `json:"lists"` - Total int64 `json:"total"` + +type ReplyGoodsLists struct { + List []GoodsItem `json:"list"` + Total int64 `json:"total"` } // Lists @Title 获取商品列表 -func (s *sku) Lists(ctx context.Context, args ArgsSkuList) (reply ReplySkuList, err error) { +func (s *sku) Lists(ctx context.Context, args ArgsGoodsList) (reply ReplyGoodsLists, err error) { xClient, err := client.GetClient(s) if err != nil { return