diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index d99ba7444..6a98c8088 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -516,21 +516,21 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, isFull bo if len(createList) > 0 { _, err = putils.FreeBatchStoreSkuSyncInfo("创建门店商品", func(task tasksch.ITask, batchedStoreSkuList []*dao.StoreSkuSyncInfo) (result interface{}, successCount int, err error) { var failedList []*partner.StoreSkuInfoWithErr - failedList, err = singleStoreHandler.CreateStoreSkus(ctx, storeID, vendorStoreID, batchedStoreSkuList) - singleStoreHandler.IsErrSkuExist(err) - if skuNameList, err2 := singleStoreHandler.GetStoreSkusFullInfo(ctx, task, storeID, vendorStoreID, []*partner.StoreSkuInfo{ - &partner.StoreSkuInfo{ - SkuID: batchedStoreSkuList[0].SkuID, - }, - }); err2 == nil && len(skuNameList) > 0 { - batchedStoreSkuList[0].VendorNameID = skuNameList[0].VendorNameID - batchedStoreSkuList[0].VendorSkuID = skuNameList[0].SkuList[0].VendorSkuID + if failedList, err = singleStoreHandler.CreateStoreSkus(ctx, storeID, vendorStoreID, batchedStoreSkuList); singleStoreHandler.IsErrSkuExist(err) { + if skuNameList, err2 := singleStoreHandler.GetStoreSkusFullInfo(ctx, task, storeID, vendorStoreID, []*partner.StoreSkuInfo{ + &partner.StoreSkuInfo{ + SkuID: batchedStoreSkuList[0].SkuID, + }, + }); err2 == nil && len(skuNameList) > 0 { + batchedStoreSkuList[0].VendorNameID = skuNameList[0].VendorNameID + batchedStoreSkuList[0].VendorSkuID = skuNameList[0].SkuList[0].VendorSkuID - // 如果创建商品时已经存在,需要更新 - updateList = append(updateList, calVendorPrice4StoreSku(batchedStoreSkuList[0], storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage))) - err = nil - } else { - failedList = append(failedList, putils.GetErrMsg2FailedSingleList(batchedStoreSkuList, err2, storeID, vendorID, "查询是否有该商品")...) + // 如果创建商品时已经存在,需要更新 + updateList = append(updateList, calVendorPrice4StoreSku(batchedStoreSkuList[0], storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage))) + err = nil + } else if err2 != nil { + failedList = append(failedList, putils.GetErrMsg2FailedSingleList(batchedStoreSkuList, err2, storeID, vendorID, "查询是否有该商品")...) + } } if len(failedList) > 0 { task.AddFailedList(failedList)