- ebaiapi.SkuShopCategoryMap

This commit is contained in:
gazebo
2019-07-23 18:07:15 +08:00
parent fbb97e9f3b
commit 3c5a0adb95
3 changed files with 17 additions and 4 deletions

View File

@@ -38,6 +38,7 @@ const (
KeyCustomSkuID = "custom_sku_id" KeyCustomSkuID = "custom_sku_id"
KeySkuID = "sku_id" KeySkuID = "sku_id"
KeyUPC = "upc" KeyUPC = "upc"
KeyCategoryID = "category_id"
KeyName = "name" KeyName = "name"
KeyPhone = "phone" KeyPhone = "phone"

View File

@@ -446,11 +446,18 @@ func (a *API) SkuStockUpdateOne(shopID string, stockInfo *ShopSkuInfo) (err erro
return err 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{}{ params := map[string]interface{}{
KeyShopID: shopID, KeyShopID: shopID,
KeySkuID: skuID, KeyCategoryID: categoryID,
"category_id": categoryIDsStr, }
if skuID > 0 {
params[KeySkuID] = skuID
} else {
params[KeyCustomSkuID] = customSkuID
}
if rank > 0 {
params["rank"] = rank
} }
_, err = a.AccessAPI("sku.shop.category.map", params) _, err = a.AccessAPI("sku.shop.category.map", params)
return err return err

View File

@@ -108,7 +108,7 @@ func TestSkuUpdate(t *testing.T) {
} }
func TestSkuShopCategoryMap(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 { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@@ -191,3 +191,8 @@ func TestGetEbaiCatIDFromName(t *testing.T) {
ebaiCatID := api.GetEbaiCatIDFromName("300280", "应季水果新鲜美味") ebaiCatID := api.GetEbaiCatIDFromName("300280", "应季水果新鲜美味")
t.Log(ebaiCatID) t.Log(ebaiCatID)
} }
func TestGetEbaiSkuIDFromCustomID(t *testing.T) {
ebaiCatID := api.GetEbaiSkuIDFromCustomID("300001", "31554")
t.Log(ebaiCatID)
}