+ DeleteStoreAllSkus

This commit is contained in:
gazebo
2019-07-12 15:13:02 +08:00
parent 8f0f3f2690
commit 6a84205966

View File

@@ -4,6 +4,8 @@ import (
"fmt"
"sort"
"git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
"git.rosy.net.cn/jx-callback/business/partner"
@@ -13,7 +15,29 @@ func SyncStoreSkuNew(ctx *jxcontext.Context, vendorIDs, storeIDs, nameIDs, skuID
return hint, err
}
func DeleteStoreAllCategories(ctx *jxcontext.Context, parentTask tasksch.ITask, handler partner.ISingleStoreStoreSkuHandler, vendorStoreID string, isContinueWhenError bool) (err error) {
func DeleteStoreAllSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, handler partner.ISingleStoreStoreSkuHandler, storeID int, vendorStoreID string, isContinueWhenError bool) (err error) {
skuNameList, err := handler.GetStoreAllSkus(ctx, storeID, vendorStoreID)
if err != nil {
return err
}
batchSize := handler.GetStoreSkusBatchSize(partner.FuncDeleteStoreSkus)
skuNameListList := jxutils.SplitSlice(skuNameList, batchSize)
task := tasksch.NewParallelTask(fmt.Sprintf("DeleteStoreAllSkus, vendorStoreID:%s", vendorStoreID),
tasksch.NewParallelConfig().SetBatchSize(batchSize).SetIsContinueWhenError(isContinueWhenError), ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
var skuList []*partner.BareStoreSkuInfo
for _, v := range batchItemList {
skuList = append(skuList, v.(*partner.BareStoreSkuInfo))
}
err = handler.DeleteStoreSkus(ctx, storeID, vendorStoreID, skuList)
return nil, err
}, skuNameListList)
tasksch.HandleTask(task, parentTask, true).Run()
_, err = task.GetResult(0)
return err
}
func DeleteStoreAllCategories(ctx *jxcontext.Context, parentTask tasksch.ITask, handler partner.ISingleStoreStoreSkuHandler, storeID int, vendorStoreID string, isContinueWhenError bool) (err error) {
catList, err := handler.GetStoreAllCategories(ctx, vendorStoreID)
if err != nil {
return err
@@ -43,7 +67,3 @@ func DeleteStoreAllCategories(ctx *jxcontext.Context, parentTask tasksch.ITask,
_, err = task1.GetResult(0)
return err
}
func DeleteStoreAllSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, handler partner.ISingleStoreStoreSkuHandler, vendorStoreID string, isContinueWhenError bool) (err error) {
return err
}