银豹同步京西,add测试
This commit is contained in:
@@ -950,30 +950,29 @@ func syncStoreSkusFromYb(ctx *jxcontext.Context, storeID, vendorID int, vendorSt
|
||||
deleteList = append(deleteList, v)
|
||||
}
|
||||
}
|
||||
fmt.Println("test111111111111111", storeID, vendorStoreID)
|
||||
fmt.Println("addList", utils.Format4Output(addList, false))
|
||||
fmt.Println("updateList", utils.Format4Output(updateList, false))
|
||||
fmt.Println("deleteList", utils.Format4Output(deleteList, false))
|
||||
// taskSeqFunc := func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {\
|
||||
// store, _ := dao.GetStoreDetail(db, storeID, vendorID)
|
||||
// switch step {
|
||||
// case 0:
|
||||
// if len(addList) > 0 {
|
||||
// taskFunc := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
// var (
|
||||
// v = batchItemList[0].(*partner.SkuNameInfo)
|
||||
// upc = v.YbBarCode
|
||||
// )
|
||||
// err = AddSkuNameByUpc(ctx, upc, store, v)
|
||||
// if err != nil {
|
||||
// task.AddFailedList(putils.GetErrMsg2FailedSingleList(nil, err, storeID, model.VendorChineseNames[vendorID], "根据upc创建京西商品"))
|
||||
// }
|
||||
// return retVal, err
|
||||
// }
|
||||
// taskParallel := tasksch.NewParallelTask("创建商品", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx, taskFunc, addList)
|
||||
// tasksch.HandleTask(taskParallel, task, true).Run()
|
||||
// _, err = taskParallel.GetResult(0)
|
||||
// }
|
||||
taskSeqFunc := func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
|
||||
store, _ := dao.GetStoreDetail(db, storeID, vendorID)
|
||||
switch step {
|
||||
case 0:
|
||||
if len(addList) > 0 {
|
||||
taskFunc := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
var (
|
||||
v = batchItemList[0].(*partner.SkuNameInfo)
|
||||
upc = v.YbBarCode
|
||||
)
|
||||
err = AddSkuNameByUpc(ctx, upc, store, v)
|
||||
if err != nil {
|
||||
task.AddFailedList(putils.GetErrMsg2FailedSingleList(nil, err, storeID, model.VendorChineseNames[vendorID], "根据upc创建京西商品"))
|
||||
}
|
||||
return retVal, err
|
||||
}
|
||||
taskParallel := tasksch.NewParallelTask("创建商品", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx, taskFunc, addList)
|
||||
tasksch.HandleTask(taskParallel, task, true).Run()
|
||||
_, err = taskParallel.GetResult(0)
|
||||
}
|
||||
// case 1:
|
||||
// if len(deleteList) > 0 {
|
||||
// taskFunc := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
@@ -1036,11 +1035,11 @@ func syncStoreSkusFromYb(ctx *jxcontext.Context, storeID, vendorID int, vendorSt
|
||||
// }
|
||||
// _, err = updateStoresSkusWithoutSync(ctx, db, []int{storeID}, skuBindInfosUpt, false)
|
||||
// }
|
||||
// }
|
||||
// return result, err
|
||||
// }
|
||||
// taskSeq := tasksch.NewSeqTask2("同步银豹商品到京西", ctx, true, taskSeqFunc, 3)
|
||||
// tasksch.HandleTask(taskSeq, nil, true).Run()
|
||||
// hint = taskSeq.GetID()
|
||||
}
|
||||
return result, err
|
||||
}
|
||||
taskSeq := tasksch.NewSeqTask2("同步银豹商品到京西", ctx, true, taskSeqFunc, 3)
|
||||
tasksch.HandleTask(taskSeq, nil, true).Run()
|
||||
hint = taskSeq.GetID()
|
||||
return hint, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user