Merge remote-tracking branch 'origin/mark' into don
This commit is contained in:
@@ -113,7 +113,7 @@ func SyncStorCategories(ctx *jxcontext.Context, parentTask tasksch.ITask, vendor
|
||||
return hint, err
|
||||
}
|
||||
|
||||
func SyncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorID, storeID int, vendorStoreID string, nameIDs, skuIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
func SyncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorID, storeID int, vendorStoreID string, nameIDs, skuIDs, excludeSkuIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
singleStoreHandler, _ := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreStoreSkuHandler)
|
||||
if singleStoreHandler != nil {
|
||||
if err = CreateStoreCategoryByStoreSku(ctx, vendorID, storeID, vendorStoreID, nameIDs, skuIDs); err != nil {
|
||||
@@ -128,7 +128,7 @@ func SyncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorID,
|
||||
_, err = SyncStorCategories(ctx, task, vendorID, storeID, vendorStoreID, nameIDs, skuIDs, false, isContinueWhenError)
|
||||
}
|
||||
case 1:
|
||||
err = syncStoreSkuNew(ctx, task, false, vendorID, storeID, nameIDs, skuIDs, isContinueWhenError)
|
||||
err = syncStoreSkuNew(ctx, task, false, vendorID, storeID, nameIDs, skuIDs, excludeSkuIDs, isContinueWhenError)
|
||||
}
|
||||
return result, err
|
||||
}, 2)
|
||||
@@ -155,9 +155,9 @@ func FullSyncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, vendo
|
||||
}
|
||||
case 1:
|
||||
if singleStoreHandler != nil {
|
||||
_, err = SyncStoreSkuNew(ctx, task, vendorID, storeID, vendorStoreID, nil, nil, false, isContinueWhenError)
|
||||
_, err = SyncStoreSkuNew(ctx, task, vendorID, storeID, vendorStoreID, nil, nil, nil, false, isContinueWhenError)
|
||||
} else {
|
||||
err = syncStoreSkuNew(ctx, task, true, vendorID, storeID, nil, nil, isContinueWhenError)
|
||||
err = syncStoreSkuNew(ctx, task, true, vendorID, storeID, nil, nil, nil, isContinueWhenError)
|
||||
}
|
||||
}
|
||||
return retVal, err
|
||||
@@ -253,7 +253,7 @@ func updateStoreSku(db *dao.DaoDB, vendorID int, storeSkuList []*dao.StoreSkuSyn
|
||||
return num, err
|
||||
}
|
||||
|
||||
func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, isFull bool, vendorID, storeID int, nameIDs, skuIDs []int, isContinueWhenError bool) (err error) {
|
||||
func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, isFull bool, vendorID, storeID int, nameIDs, skuIDs, excludeSkuIDs []int, isContinueWhenError bool) (err error) {
|
||||
db := dao.GetDB()
|
||||
storeDetail, err := dao.GetStoreDetail(db, storeID, vendorID)
|
||||
if err != nil {
|
||||
@@ -270,6 +270,16 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, isFull bo
|
||||
if err != nil || len(skus) == 0 {
|
||||
return err
|
||||
}
|
||||
if len(excludeSkuIDs) > 0 {
|
||||
excludeSkuMap := jxutils.IntList2Map(excludeSkuIDs)
|
||||
var skus2 []*dao.StoreSkuSyncInfo
|
||||
for _, v := range skus {
|
||||
if excludeSkuMap[v.SkuID] == 0 {
|
||||
skus2 = append(skus2, v)
|
||||
}
|
||||
}
|
||||
skus = skus2
|
||||
}
|
||||
formalizeStoreSkuList(skus)
|
||||
|
||||
singleStoreHandler, _ := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreStoreSkuHandler)
|
||||
|
||||
Reference in New Issue
Block a user