- ebaiapi.SkuShopCategoryMap
This commit is contained in:
@@ -38,6 +38,7 @@ const (
|
||||
KeyCustomSkuID = "custom_sku_id"
|
||||
KeySkuID = "sku_id"
|
||||
KeyUPC = "upc"
|
||||
KeyCategoryID = "category_id"
|
||||
|
||||
KeyName = "name"
|
||||
KeyPhone = "phone"
|
||||
|
||||
@@ -446,11 +446,18 @@ func (a *API) SkuStockUpdateOne(shopID string, stockInfo *ShopSkuInfo) (err erro
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *API) SkuShopCategoryMap(shopID string, skuID int64, categoryIDsStr string) (err error) {
|
||||
func (a *API) SkuShopCategoryMap(shopID string, skuID int64, customSkuID string, categoryID int64, rank int) (err error) {
|
||||
params := map[string]interface{}{
|
||||
KeyShopID: shopID,
|
||||
KeySkuID: skuID,
|
||||
"category_id": categoryIDsStr,
|
||||
KeyCategoryID: categoryID,
|
||||
}
|
||||
if skuID > 0 {
|
||||
params[KeySkuID] = skuID
|
||||
} else {
|
||||
params[KeyCustomSkuID] = customSkuID
|
||||
}
|
||||
if rank > 0 {
|
||||
params["rank"] = rank
|
||||
}
|
||||
_, err = a.AccessAPI("sku.shop.category.map", params)
|
||||
return err
|
||||
|
||||
@@ -108,7 +108,7 @@ func TestSkuUpdate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSkuShopCategoryMap(t *testing.T) {
|
||||
err := api.SkuShopCategoryMap(testShopID, 15378849314129969, "153760472317166")
|
||||
err := api.SkuShopCategoryMap(testShopID, 0, "2212", 15637192270716, 100)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -191,3 +191,8 @@ func TestGetEbaiCatIDFromName(t *testing.T) {
|
||||
ebaiCatID := api.GetEbaiCatIDFromName("300280", "应季水果新鲜美味")
|
||||
t.Log(ebaiCatID)
|
||||
}
|
||||
|
||||
func TestGetEbaiSkuIDFromCustomID(t *testing.T) {
|
||||
ebaiCatID := api.GetEbaiSkuIDFromCustomID("300001", "31554")
|
||||
t.Log(ebaiCatID)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user