fix ammend to amend

This commit is contained in:
gazebo
2019-10-24 10:31:38 +08:00
parent 3269a059a7
commit c0a43cf064

View File

@@ -22,9 +22,9 @@ import (
)
const (
AmmendPruneOnlyAmend = 1
AmmendPruneOnlyPrune = 2
AmmendPruneAll = 3
AmendPruneOnlyAmend = 1
AmendPruneOnlyPrune = 2
AmendPruneAll = 3
)
var (
@@ -588,10 +588,10 @@ func fillRemoteCatMap(catList []*partner.BareCategoryInfo, catMap map[string]int
// 清除京西没有,平台有的商品与商家分类
// todo !!!,因为美团外卖分类当前是用的名字关联的,所以改名后如果没有及时同步,这个函数会导致美团平台的分类被误删
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)
if handler == nil {
return "", fmt.Errorf("平台:%s不支持此操作", model.VendorChineseNames[vendorID])
@@ -636,7 +636,7 @@ func ammendAndPruneStoreStuff(ctx *jxcontext.Context, parentTask tasksch.ITask,
}
}
case 1:
if (opType == AmmendPruneOnlyAmend || opType == AmmendPruneAll) && len(storeSkuBindIDs) > 0 {
if (opType == AmendPruneOnlyAmend || opType == AmendPruneAll) && len(storeSkuBindIDs) > 0 {
for _, bindID := range storeSkuBindIDs {
fieldStatus := dao.GetSyncStatusStructField(model.VendorNames[vendorID])
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 = handler.DeleteStoreSkus(ctx, storeID, vendorStoreID, batchedStoreSkuList)
return nil, 0, err
@@ -677,7 +677,7 @@ func ammendAndPruneStoreStuff(ctx *jxcontext.Context, parentTask tasksch.ITask,
}
}
case 3:
if (opType == AmmendPruneOnlyAmend || opType == AmmendPruneAll) && len(storeCatBindIDs) > 0 {
if (opType == AmendPruneOnlyAmend || opType == AmendPruneAll) && len(storeCatBindIDs) > 0 {
for _, bindID := range storeCatBindIDs {
fieldStatus := dao.GetSyncStatusStructField(model.VendorNames[vendorID])
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++ {
level := 2 - i
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) {
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)
// if handler == nil {
// return "", fmt.Errorf("平台:%s不支持此操作", model.VendorChineseNames[vendorID])