From 7592e9a3741aa7c003ab4c03a719d876c1e0124f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 1 Jul 2020 17:27:02 +0800 Subject: [PATCH] =?UTF-8?q?=E9=93=B6=E8=B1=B9=E5=88=9B=E5=BB=BA=E5=95=86?= =?UTF-8?q?=E5=93=81=E5=A4=B1=E8=B4=A5=EF=BC=8C=E5=B0=9D=E8=AF=95=E6=8A=8A?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=9A=84=E6=81=A2=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 4 ---- business/partner/purchase/yb/store_sku.go | 20 +++++++++++--------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 7858319e0..9178cc301 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -3983,11 +3983,7 @@ func BackUpStoreSkuBind(ctx *jxcontext.Context, isAsync, isContinueWhenError boo storeSkuBindHis := &model.StoreSkuBindHistory{ SnapshotAt: snapshotAt.AddDate(0, 0, -2), } - storeSkuBindHis2 := &model.StoreSkuBindHistory{ - SnapshotAt: snapshotAt, - } dao.DeleteEntity(db, storeSkuBindHis, "SnapshotAt") - dao.DeleteEntity(db, storeSkuBindHis2, "SnapshotAt") storeList, err := dao.GetStoreList(db, nil, nil, nil, nil, "") task := tasksch.NewParallelTask("BackUpStoreSkuBind", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { diff --git a/business/partner/purchase/yb/store_sku.go b/business/partner/purchase/yb/store_sku.go index 12add114e..f7857ef4e 100644 --- a/business/partner/purchase/yb/store_sku.go +++ b/business/partner/purchase/yb/store_sku.go @@ -38,15 +38,17 @@ func (p *PurchaseHandler) CreateStoreSkus(ctx *jxcontext.Context, storeID int, v result, err = api.YinBaoAPI.AddProductInfo(buildProductInfoParam(storeSku)) } if err != nil { - // if strings.Contains(err.Error(), addErr1) { - // queryProductByBarcodeResult, err := api.YinBaoAPI.QueryProductByBarcodes([]string{storeSku.YbBarCode}) - // if err != nil && len(queryProductByBarcodeResult) > 0 { - // if queryProductByBarcodeResult[0].Enable == model.SkuStatusDeleted { - // api.YinBaoAPI.SaveProduct(userId, keyword, saveProductParam) - // } - // } - // } - failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDYB], "创建商品") + if strings.Contains(err.Error(), addErr1) { + queryProductByBarcodeResult, err := api.YinBaoAPI.QueryProductByBarcodes([]string{storeSku.YbBarCode}) + if err != nil && len(queryProductByBarcodeResult) > 0 { + if queryProductByBarcodeResult[0].Enable == model.SkuStatusDeleted { + api.YinBaoAPI.BatchUpdateProductEnable(vendorStoreID, utils.Int64ToStr(queryProductByBarcodeResult[0].UID), model.SkuStatusNormal) + storeSku.VendorSkuID = utils.Int64ToStr(queryProductByBarcodeResult[0].UID) + } + } + } else { + failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDYB], "创建商品") + } } else { storeSku.VendorSkuID = utils.Int64ToStr(result.UID) err = uploadYbImage(vendorStoreID, storeSku.YbBarCode, storeSku.Img)