diff --git a/otosaas/commodity.go b/otosaas/commodity.go index 81e8f37..c3e01b5 100644 --- a/otosaas/commodity.go +++ b/otosaas/commodity.go @@ -76,49 +76,41 @@ type ArgsGoodsInfo struct { SkuId uint } -type ReplyGoodsInfo struct { - Id uint `json:"id"` - Name string `json:"name"` - SupplierId uint `json:"supplierId"` - SupplierName string `json:"supplierName"` - CategoryId uint `json:"categoryId"` - BrandId uint `json:"brandId"` - Imgs []string `json:"imgs"` - Content string `json:"content"` - Attributes []GoodsAttributeItem `json:"attributes"` - Skus []SkuItem `json:"skus"` - Status uint `json:"status"` -} - -type GoodsAttributeItem struct { - Name string `json:"name"` - Value string `json:"value"` - GroupName string `json:"groupName"` -} - -type SkuSpecItem struct { - Name string `json:"name"` - Value string `json:"value"` +type ReplyCommodityInfo struct { + Id uint `json:"id"` + CommodityCode string `json:"commodityCode"` + Name string `json:"name"` + ImgUrl string `json:"imgUrl"` + FirstCategoryId uint `json:"firstCategoryId"` + FirstCategoryName string `json:"firstCategoryName"` + SecondCategoryId uint `json:"secondCategoryId"` + SecondCategoryName string `json:"secondCategoryName"` + ThirdCategoryId uint `json:"thirdCategoryId"` + ThirdCategoryName string `json:"thirdCategoryName"` + Handle uint `json:"handle"` + Status uint `json:"status"` + Skus []SkuItem `json:"skus"` + Imgs []CommodityImgItem `json:"imgs"` +} + +type CommodityImgItem struct { + Id uint `json:"id"` + Path string `json:"path"` + ReplacePath string `json:"replacePath"` } type SkuItem struct { - SkuId uint `json:"skuId"` - Color string `json:"color"` - Size string `json:"size"` - SupplyPrice decimal.Decimal `json:"supplyPrice"` - MarketPrice decimal.Decimal `json:"marketPrice"` - UpcCode string `json:"upcCode"` - UnitId uint `json:"uintId"` - TaxCategoryId uint `json:"taxCategoryId"` - TaxName string `json:"taxName"` - TaxCode string `json:"taxCode"` - Unit string `json:"uint"` - Tax decimal.Decimal `json:"tax"` - Img string `json:"img"` + Id uint `json:"id"` + SkuCode string `json:"skuCode"` + SpecName string `json:"specName"` + SpecValue string `json:"specValue"` + SupplyPrice decimal.Decimal `json:"supplyPrice"` + GuidePrice decimal.Decimal `json:"guidePrice"` + ImgUrl string `json:"imgUrl"` } // Info @Title 商品详情 -func (g *commodity) Info(ctx context.Context, goodsId uint) (reply ReplyGoodsInfo, err error) { +func (g *commodity) Info(ctx context.Context, goodsId uint) (reply ReplyCommodityInfo, err error) { xClient, err := client.GetClient(g) if err != nil { return @@ -127,13 +119,18 @@ func (g *commodity) Info(ctx context.Context, goodsId uint) (reply ReplyGoodsInf return } +type ReplyImgs struct { + GoodsId uint `json:"goodsId"` + Imgs []string `json:"imgs"` +} + // GetImgs @Title 获取商品主图 -func (g *commodity) GetImgs(ctx context.Context, goodsId uint) (reply []string, err error) { +func (g *commodity) GetImgs(ctx context.Context, goodsIds []uint) (reply []ReplyImgs, err error) { xClient, err := client.GetClient(g) if err != nil { return } - err = xClient.Call(ctx, "GetImgs", goodsId, &reply) + err = xClient.Call(ctx, "GetImgs", goodsIds, &reply) return }