Merge branch 'jdshop' of e.coding.net:rosydev/jx-callback into jdshop
This commit is contained in:
@@ -556,7 +556,6 @@ func (v *VendorSync) SyncStoresSkus(ctx *jxcontext.Context, parentTask tasksch.I
|
||||
func (c *ComparePlatform) CompareStoreWithOperator(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs []int, storeIDs []int, syncDisabled bool, excludeSkuIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
return hint, makeSyncError(err)
|
||||
}
|
||||
|
||||
func (v *VendorSync) FullSyncStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs []int, storeIDs []int, syncDisabled bool, excludeSkuIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
hint, err = v.LoopStoresMap(ctx, db, fmt.Sprintf("初始化门店商品信息:%v", storeIDs), isAsync, true, vendorIDs, storeIDs,
|
||||
func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (interface{}, error) {
|
||||
|
||||
@@ -75,7 +75,6 @@ func SyncStoreCategories(ctx *jxcontext.Context, parentTask tasksch.ITask, vendo
|
||||
rootTask := tasksch.NewSeqTask(fmt.Sprintf("%s SyncStoreCategory step1", model.VendorChineseNames[vendorID]), ctx,
|
||||
func(rootTask *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
|
||||
level := step + 1
|
||||
//todo 这里好像有点问题
|
||||
catList, err := dao.GetDirtyStoreCategories(db, vendorID, storeID, level, skuIDs)
|
||||
if len(catList) > 0 {
|
||||
num += len(catList)
|
||||
@@ -186,6 +185,7 @@ func SyncStoreSkuNew2(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFla
|
||||
case 0:
|
||||
if singleStoreHandler != nil {
|
||||
_, err = SyncStoreCategories(ctx, task, vendorID, storeID, vendorStoreID, nameIDs, skuIDs, false, isContinueWhenError)
|
||||
globals.SugarLogger.Debug("SyncStoreCategories in SyncStoreSkuNew2 err on:%v", err)
|
||||
}
|
||||
case 1:
|
||||
err = syncStoreSkuNew(ctx, task, causeFlag, false, vendorID, storeID, vendorOrgCode, nameIDs, skuIDs, excludeSkuIDs, useVendorPriceDirectly, isContinueWhenError)
|
||||
@@ -702,7 +702,6 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
|
||||
var failedList []*partner.StoreSkuInfoWithErr
|
||||
if failedList, err = singleStoreHandler.CreateStoreSkus(ctx, storeID, vendorStoreID, batchedStoreSkuList); singleStoreHandler.IsErrSkuExist(err) {
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debug("30.sth wrong on singleStoreHandler.CreateStoreSkus: %v", err)
|
||||
}
|
||||
if skuNameList, err2 := singleStoreHandler.GetStoreSkusFullInfo(ctx, task, storeID, vendorStoreID, []*partner.StoreSkuInfo{
|
||||
&partner.StoreSkuInfo{
|
||||
@@ -754,23 +753,13 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
|
||||
_, err = putils.FreeBatchStoreSkuSyncInfo("更新门店商品基础信息", func(task tasksch.ITask, batchedStoreSkuList []*dao.StoreSkuSyncInfo) (result interface{}, successCount int, err error) {
|
||||
var failedList []*partner.StoreSkuInfoWithErr
|
||||
failedList, err = singleStoreHandler.UpdateStoreSkus(ctx, storeID, vendorStoreID, batchedStoreSkuList)
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debugf("21.sth wrong on singleStoreHandler.UpdateStoreSkus: %v", err)
|
||||
}
|
||||
failedList, err = buildFailedListAndErr(failedList, err, nil, batchedStoreSkuList, storeID, vendorID, "更新门店商品基础信息")
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debugf("22.sth wrong on buildFailedListAndErr: %v", err)
|
||||
}
|
||||
if len(failedList) > 0 {
|
||||
task.AddFailedList(failedList)
|
||||
}
|
||||
successList := putils.UnselectStoreSkuSyncListByVendorSkuIDs(batchedStoreSkuList, GetVendorSkuIDList(failedList))
|
||||
if len(successList) > 0 {
|
||||
_, err := updateStoreSku(dao.GetDB(), vendorID, successList, model.SyncFlagModifiedMask)
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debugf("24.sth wrong on updateStoreSku: %v", err)
|
||||
//return nil, 0, err
|
||||
}
|
||||
_, err = updateStoreSku(dao.GetDB(), vendorID, successList, model.SyncFlagModifiedMask)
|
||||
}
|
||||
return nil, len(successList), err
|
||||
}, ctx, task, updateList, singleStoreHandler.GetStoreSkusBatchSize(partner.FuncUpdateStoreSkus), isContinueWhenError2)
|
||||
|
||||
Reference in New Issue
Block a user