fix ammend to amend
This commit is contained in:
@@ -22,9 +22,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
AmmendPruneOnlyAmend = 1
|
AmendPruneOnlyAmend = 1
|
||||||
AmmendPruneOnlyPrune = 2
|
AmendPruneOnlyPrune = 2
|
||||||
AmmendPruneAll = 3
|
AmendPruneAll = 3
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -588,10 +588,10 @@ func fillRemoteCatMap(catList []*partner.BareCategoryInfo, catMap map[string]int
|
|||||||
// 清除京西没有,平台有的商品与商家分类
|
// 清除京西没有,平台有的商品与商家分类
|
||||||
// todo !!!,因为美团外卖分类当前是用的名字关联的,所以改名后如果没有及时同步,这个函数会导致美团平台的分类被误删
|
// todo !!!,因为美团外卖分类当前是用的名字关联的,所以改名后如果没有及时同步,这个函数会导致美团平台的分类被误删
|
||||||
func PruneMissingStoreSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorID, storeID int, vendorStoreID string, isAsync, isContinueWhenError bool) (hint string, err error) {
|
func PruneMissingStoreSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorID, storeID int, vendorStoreID string, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||||
return ammendAndPruneStoreStuff(ctx, parentTask, vendorID, storeID, vendorStoreID, isAsync, isContinueWhenError, AmmendPruneOnlyPrune)
|
return amendAndPruneStoreStuff(ctx, parentTask, vendorID, storeID, vendorStoreID, isAsync, isContinueWhenError, AmendPruneOnlyPrune)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ammendAndPruneStoreStuff(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorID, storeID int, vendorStoreID string, isAsync, isContinueWhenError bool, opType int) (hint string, err error) {
|
func amendAndPruneStoreStuff(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorID, storeID int, vendorStoreID string, isAsync, isContinueWhenError bool, opType int) (hint string, err error) {
|
||||||
handler, _ := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreStoreSkuHandler)
|
handler, _ := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreStoreSkuHandler)
|
||||||
if handler == nil {
|
if handler == nil {
|
||||||
return "", fmt.Errorf("平台:%s不支持此操作", model.VendorChineseNames[vendorID])
|
return "", fmt.Errorf("平台:%s不支持此操作", model.VendorChineseNames[vendorID])
|
||||||
@@ -636,7 +636,7 @@ func ammendAndPruneStoreStuff(ctx *jxcontext.Context, parentTask tasksch.ITask,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
if (opType == AmmendPruneOnlyAmend || opType == AmmendPruneAll) && len(storeSkuBindIDs) > 0 {
|
if (opType == AmendPruneOnlyAmend || opType == AmendPruneAll) && len(storeSkuBindIDs) > 0 {
|
||||||
for _, bindID := range storeSkuBindIDs {
|
for _, bindID := range storeSkuBindIDs {
|
||||||
fieldStatus := dao.GetSyncStatusStructField(model.VendorNames[vendorID])
|
fieldStatus := dao.GetSyncStatusStructField(model.VendorNames[vendorID])
|
||||||
skuBind := &model.StoreSkuBind{}
|
skuBind := &model.StoreSkuBind{}
|
||||||
@@ -645,7 +645,7 @@ func ammendAndPruneStoreStuff(ctx *jxcontext.Context, parentTask tasksch.ITask,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opType == AmmendPruneOnlyPrune || opType == AmmendPruneAll) && len(sku2Delete) > 0 {
|
if (opType == AmendPruneOnlyPrune || opType == AmendPruneAll) && len(sku2Delete) > 0 {
|
||||||
_, err = putils.FreeBatchStoreSkuInfo("删除门店商品", func(task tasksch.ITask, batchedStoreSkuList []*partner.StoreSkuInfo) (result interface{}, successCount int, err error) {
|
_, err = putils.FreeBatchStoreSkuInfo("删除门店商品", func(task tasksch.ITask, batchedStoreSkuList []*partner.StoreSkuInfo) (result interface{}, successCount int, err error) {
|
||||||
_, err = handler.DeleteStoreSkus(ctx, storeID, vendorStoreID, batchedStoreSkuList)
|
_, err = handler.DeleteStoreSkus(ctx, storeID, vendorStoreID, batchedStoreSkuList)
|
||||||
return nil, 0, err
|
return nil, 0, err
|
||||||
@@ -677,7 +677,7 @@ func ammendAndPruneStoreStuff(ctx *jxcontext.Context, parentTask tasksch.ITask,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
if (opType == AmmendPruneOnlyAmend || opType == AmmendPruneAll) && len(storeCatBindIDs) > 0 {
|
if (opType == AmendPruneOnlyAmend || opType == AmendPruneAll) && len(storeCatBindIDs) > 0 {
|
||||||
for _, bindID := range storeCatBindIDs {
|
for _, bindID := range storeCatBindIDs {
|
||||||
fieldStatus := dao.GetSyncStatusStructField(model.VendorNames[vendorID])
|
fieldStatus := dao.GetSyncStatusStructField(model.VendorNames[vendorID])
|
||||||
catBind := &model.StoreSkuCategoryMap{}
|
catBind := &model.StoreSkuCategoryMap{}
|
||||||
@@ -686,7 +686,7 @@ func ammendAndPruneStoreStuff(ctx *jxcontext.Context, parentTask tasksch.ITask,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opType == AmmendPruneOnlyPrune || opType == AmmendPruneAll) && len(cat2Delete) > 0 {
|
if (opType == AmendPruneOnlyPrune || opType == AmendPruneAll) && len(cat2Delete) > 0 {
|
||||||
for i := 0; i < 2; i++ {
|
for i := 0; i < 2; i++ {
|
||||||
level := 2 - i
|
level := 2 - i
|
||||||
var levelCat2Delete []*partner.BareCategoryInfo
|
var levelCat2Delete []*partner.BareCategoryInfo
|
||||||
@@ -722,7 +722,7 @@ func ammendAndPruneStoreStuff(ctx *jxcontext.Context, parentTask tasksch.ITask,
|
|||||||
|
|
||||||
// 把京西有,平台无且没有待创建标记的商品加上待创建标记
|
// 把京西有,平台无且没有待创建标记的商品加上待创建标记
|
||||||
func AddCreateFlagForJxStoreSku(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorID, storeID int, vendorStoreID string, isAsync, isContinueWhenError bool) (hint string, err error) {
|
func AddCreateFlagForJxStoreSku(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorID, storeID int, vendorStoreID string, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||||
return ammendAndPruneStoreStuff(ctx, parentTask, vendorID, storeID, vendorStoreID, isAsync, isContinueWhenError, AmmendPruneOnlyAmend)
|
return amendAndPruneStoreStuff(ctx, parentTask, vendorID, storeID, vendorStoreID, isAsync, isContinueWhenError, AmendPruneOnlyAmend)
|
||||||
// handler, _ := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreStoreSkuHandler)
|
// handler, _ := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreStoreSkuHandler)
|
||||||
// if handler == nil {
|
// if handler == nil {
|
||||||
// return "", fmt.Errorf("平台:%s不支持此操作", model.VendorChineseNames[vendorID])
|
// return "", fmt.Errorf("平台:%s不支持此操作", model.VendorChineseNames[vendorID])
|
||||||
|
|||||||
Reference in New Issue
Block a user