diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index a4dfd78ca..177f56c0e 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -218,11 +218,16 @@ func updateOrCreateCategories(storeCat *dao.SkuStoreCatInfo, isCreate bool) (err if isCreate { createShopCategoryParam2.Type = jdshopapi.CreateCatType createShopCategoryParam2.ID = "1" + createShopCategoryParams = append(createShopCategoryParams, createShopCategoryParam2) } else { createShopCategoryParam2.Type = jdshopapi.UpdateCatType createShopCategoryParam2.ID = storeCat.VendorCatID + for _, v := range createShopCategoryParams { + if v.ID == storeCat.VendorCatID { + v = createShopCategoryParam2 + } + } } - createShopCategoryParams = append(createShopCategoryParams, createShopCategoryParam2) err = api.JdShopAPI.CreateShopCategory(createShopCategoryParams) return err }