1
This commit is contained in:
@@ -157,11 +157,31 @@ func (p *PurchaseHandler) CreateStoreCategory(ctx *jxcontext.Context, storeID in
|
|||||||
SecondaryCategoryName: subCatName,
|
SecondaryCategoryName: subCatName,
|
||||||
Sequence: storeCat.Seq,
|
Sequence: storeCat.Seq,
|
||||||
}
|
}
|
||||||
err = getAPI(storeCat.VendorOrgCode, storeID, vendorStoreID).RetailCatUpdate(vendorStoreID, catName, param4Update)
|
api := getAPI(storeCat.VendorOrgCode, storeID, vendorStoreID)
|
||||||
|
err = api.RetailCatUpdate(vendorStoreID, catName, param4Update)
|
||||||
if storeCat.CatSyncStatus&model.SyncFlagNewMask == 0 && p.IsErrCategoryNotExist(err) && originName != "" { // 修改分类名,但分类不存在
|
if storeCat.CatSyncStatus&model.SyncFlagNewMask == 0 && p.IsErrCategoryNotExist(err) && originName != "" { // 修改分类名,但分类不存在
|
||||||
storeCat.CatSyncStatus |= model.SyncFlagNewMask
|
storeCat.CatSyncStatus |= model.SyncFlagNewMask
|
||||||
err = p.CreateStoreCategory(ctx, storeID, vendorStoreID, storeCat)
|
err = p.CreateStoreCategory(ctx, storeID, vendorStoreID, storeCat)
|
||||||
}
|
}
|
||||||
|
if err != nil && strings.Contains(err.Error(), "门店内存在重复的分类:") {
|
||||||
|
storeCategoryList, err2 := api.RetailCatList(vendorStoreID)
|
||||||
|
if err2 != nil {
|
||||||
|
err = err2
|
||||||
|
} else {
|
||||||
|
for _, v := range storeCategoryList {
|
||||||
|
if len(v.Children) > 0 {
|
||||||
|
for _, c := range v.Children {
|
||||||
|
if strings.Contains(c.Name, err.Error()) {
|
||||||
|
api.RetailCatDelete(vendorStoreID, "", c.Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if strings.Contains(v.Name, err.Error()) {
|
||||||
|
api.RetailCatDelete(vendorStoreID, "", v.Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
// storeCat.VendorCatID = utils.FilterEmoji(storeCat.Name)
|
// storeCat.VendorCatID = utils.FilterEmoji(storeCat.Name)
|
||||||
|
|||||||
Reference in New Issue
Block a user