diff --git a/platformapi/weimobapi/goods.go b/platformapi/weimobapi/goods.go index abe06c66..f2c6fe0b 100644 --- a/platformapi/weimobapi/goods.go +++ b/platformapi/weimobapi/goods.go @@ -84,6 +84,17 @@ func (a *API) QueryGoodsList(pageNum, pageSize int, orderBy []map[string]interfa return nil, 0, err } +func (a *API) QueryGoodsDetail(goodsId int64) (retVal map[string]interface{}, err error) { + apiParams := map[string]interface{}{ + "goodsId": goodsId, + } + result, err := a.AccessAPI("goods/queryGoodsDetail", apiParams) + if err == nil { + return result.(map[string]interface{})["goods"].(map[string]interface{}), nil + } + return nil, err +} + func (a *API) QueryCategoryTree() (retVal []*Category, err error) { result, err := a.AccessAPI("category/queryCategoryTree", nil) if err == nil { diff --git a/platformapi/weimobapi/goods_test.go b/platformapi/weimobapi/goods_test.go index 9b067970..440d1bd4 100644 --- a/platformapi/weimobapi/goods_test.go +++ b/platformapi/weimobapi/goods_test.go @@ -16,6 +16,14 @@ func TestQueryGoodsList(t *testing.T) { baseapi.SugarLogger.Debug(utils.Format4Output(result, false)) } +func TestQueryGoodsDetail(t *testing.T) { + result, err := api.QueryGoodsDetail(21128350148) + if err != nil { + t.Fatal(err) + } + baseapi.SugarLogger.Debug(utils.Format4Output(result, false)) +} + func TestQueryCategoryTree(t *testing.T) { result, err := api.QueryCategoryTree() if err != nil { diff --git a/platformapi/weimobapi/weimobapi.go b/platformapi/weimobapi/weimobapi.go index 9a32236a..d0580e4b 100644 --- a/platformapi/weimobapi/weimobapi.go +++ b/platformapi/weimobapi/weimobapi.go @@ -29,15 +29,17 @@ const ( const ( // sku - KeySkuID = "skuId" - KeyOuterSkuCode = "outerSkuCode" - KeyImageURL = "imageUrl" - KeySalePrice = "salePrice" - KeyOriginalPrice = "originalPrice" - KeyCostPrice = "costPrice" - KeyEditStockNum = "editStockNum" - KeyB2cSku = "b2cSku" - KeySkuAttrMap = "skuAttrMap" + KeySkuID = "skuId" + KeyOuterSkuCode = "outerSkuCode" + KeyImageURL = "imageUrl" + KeySalePrice = "salePrice" + KeyOriginalPrice = "originalPrice" + KeyCostPrice = "costPrice" + KeyEditStockNum = "editStockNum" + KeyAvailableStockNum = "availableStockNum" + KeySkuList = "skuList" + KeyB2cSku = "b2cSku" + KeySkuAttrMap = "skuAttrMap" KeyField = "field" KeySort = "sort"