- 饿百将一个分类重复改名,也会报分类名重复错,特殊处理一下,不过因为GetStoreCategory其实会拉取所有的门店分类,是比较耗时的操作

This commit is contained in:
gazebo
2019-09-09 14:23:37 +08:00
parent 322d196992
commit edd0e8c282
2 changed files with 10 additions and 2 deletions

View File

@@ -83,6 +83,14 @@ func (p *PurchaseHandler) CreateStoreCategory(ctx *jxcontext.Context, storeID in
func (p *PurchaseHandler) UpdateStoreCategory(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeCat *dao.SkuStoreCatInfo) (err error) {
if globals.EnableEbaiStoreWrite {
err = api.EbaiAPI.ShopCategoryUpdate(utils.Int2Str(storeID), utils.Str2Int64WithDefault(storeCat.VendorCatID, 0), formatCatName(storeCat.Name), jxCatSeq2Ebai(storeCat.Seq))
// todo, 饿百将一个分类重复改名也会报分类名重复错特殊处理一下不过因为GetStoreCategory其实会拉取所有的门店分类是比较耗时的操作
if utils.IsErrMatch(err, "1", []string{"分类名称已经存在"}) {
if cat, err2 := p.GetStoreCategory(ctx, storeID, vendorStoreID, storeCat.Name); err2 == nil {
if cat.VendorCatID == storeCat.VendorCatID {
err = nil
}
}
}
}
return err
}

View File

@@ -36,8 +36,8 @@ func (c *SyncController) SyncStoresSkus() {
})
}
// @Title 同步商家商品信息
// @Description 同步商家商品信息
// @Title 同步商家分类信息
// @Description 同步商家分类信息
// @Param token header string true "认证token"
// @Param storeIDs formData string true "门店ID列表"
// @Param vendorIDs formData string true "厂商ID列表"