添加美团服务商配置,修改抖音自动获取品牌
This commit is contained in:
@@ -162,7 +162,19 @@ func (p *PurchaseHandler) CreateStoreCategory(ctx *jxcontext.Context, storeID in
|
||||
storeCat.CatSyncStatus |= model.SyncFlagNewMask
|
||||
err = p.CreateStoreCategory(ctx, storeID, vendorStoreID, storeCat)
|
||||
}
|
||||
|
||||
// 门店内存在重复的分类:【柑桔柚类】 【底料】,请先删除重复分类后再操作。
|
||||
if err != nil && strings.Contains(err.Error(), "门店内存在重复的分类:") {
|
||||
for _, v := range deleteRepeatCat(err.Error()) {
|
||||
if len(v) > 0 {
|
||||
if err2 := api.RetailCatDelete(vendorStoreID, "", v, model.YES); err != nil {
|
||||
globals.SugarLogger.Errorf("RetailCatDelete delete err : [%v]", err2)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if err == nil {
|
||||
// storeCat.VendorCatID = utils.FilterEmoji(storeCat.Name)
|
||||
storeCat.VendorCatID = utils.Int2Str(storeCat.ID)
|
||||
@@ -170,6 +182,40 @@ func (p *PurchaseHandler) CreateStoreCategory(ctx *jxcontext.Context, storeID in
|
||||
return err
|
||||
}
|
||||
|
||||
// deleteRepeatCat 门店内存在重复的分类:【柑桔柚类】 【底料】 【火锅】,请先删除重复分类后再操作。
|
||||
func deleteRepeatCat(param string) []string {
|
||||
firstIndex := strings.Index(param, "【")
|
||||
lastIndex := strings.LastIndex(param, "】")
|
||||
newParam := param[firstIndex:lastIndex]
|
||||
deleteCat := make([]string, 0, 0)
|
||||
for _, v := range strings.Split(newParam, "【") {
|
||||
if strings.TrimSpace(v) == "" {
|
||||
continue
|
||||
} else if strings.Contains(v, "【") {
|
||||
for _, v2 := range strings.Split(v, "【") {
|
||||
if strings.TrimSpace(v) == "" {
|
||||
continue
|
||||
}
|
||||
if strings.TrimSpace(v2) != "" {
|
||||
deleteCat = append(deleteCat, v2)
|
||||
}
|
||||
}
|
||||
} else if strings.Contains(v, "】") {
|
||||
for _, v3 := range strings.Split(v, "】") {
|
||||
if strings.TrimSpace(v3) == "" {
|
||||
continue
|
||||
}
|
||||
if strings.TrimSpace(v3) != "" {
|
||||
deleteCat = append(deleteCat, v3)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
deleteCat = append(deleteCat, v)
|
||||
}
|
||||
}
|
||||
return deleteCat
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) UpdateStoreCategory(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeCat *dao.SkuStoreCatInfo) (err error) {
|
||||
return p.CreateStoreCategory(ctx, storeID, vendorStoreID, storeCat)
|
||||
}
|
||||
@@ -177,7 +223,7 @@ func (p *PurchaseHandler) UpdateStoreCategory(ctx *jxcontext.Context, storeID in
|
||||
func (p *PurchaseHandler) DeleteStoreCategory(ctx *jxcontext.Context, storeID int, vendorStoreID, vendorCatID string, level int) (err error) {
|
||||
if false {
|
||||
if globals.EnableMtwmStoreWrite {
|
||||
err = getAPI(getStoreVendorOrgCode(storeID), storeID, vendorStoreID).RetailCatDelete(vendorStoreID, tryCatName2Code(vendorCatID), vendorCatID)
|
||||
err = getAPI(getStoreVendorOrgCode(storeID), storeID, vendorStoreID).RetailCatDelete(vendorStoreID, tryCatName2Code(vendorCatID), vendorCatID, model.NO)
|
||||
}
|
||||
} else {
|
||||
var catCodes []string
|
||||
|
||||
Reference in New Issue
Block a user