From 1c390bc99b5dc7170cf169cfb0fa058222634bfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 5 Jan 2023 09:04:32 +0800 Subject: [PATCH] 1 --- .../purchase/tiktok_store/store_sku2_utils.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/business/partner/purchase/tiktok_store/store_sku2_utils.go b/business/partner/purchase/tiktok_store/store_sku2_utils.go index 76a9b07e4..cfbc02eb8 100644 --- a/business/partner/purchase/tiktok_store/store_sku2_utils.go +++ b/business/partner/purchase/tiktok_store/store_sku2_utils.go @@ -273,7 +273,7 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI // 主商品存在,直接同步子商品 childrenProductId, err := api.CreateSubProduct(utils.Str2Int64(localThing[0].VendorThingID), utils.Str2Int64(vendorStoreID)) globals.SugarLogger.Debugf("===============err %s", err.Error()) - globals.SugarLogger.Debugf("===============err %s", utils.Format4Output(err != nil && strings.Contains(err.Error(), "2010004"), false)) + globals.SugarLogger.Debugf("===============childrenProductId %d", childrenProductId) if err != nil && strings.Contains(err.Error(), "2010004") { // 2010004:主商品非在线审核通过状态,不允许绑定子商品 // 线上本地都存在,但是线上审核不成功,就去更新主商品 mainOrderDetail = loadMainProductId(api, storeSku, localThing[0].VendorThingID) @@ -486,6 +486,7 @@ func checkNameLenght(name string) string { return name } func upDateChildrenPriceStockLaunch(api *tiktokShop.API, storeSku *dao.StoreSkuSyncInfo, childrenProductId int64, vendorStoreID, syncType string) (failedList []*partner.StoreSkuInfoWithErr) { + globals.SugarLogger.Debugf("===========1") skuId, failed := getProductSkuID(api, storeSku, syncType, childrenProductId) if skuId == 0 || len(failed) > 0 { return failed @@ -497,7 +498,10 @@ func upDateChildrenPriceStockLaunch(api *tiktokShop.API, storeSku *dao.StoreSkuS ProductId: childrenProductId, }); err != nil { failedList = putils.GetErrMsg2FailedSingleList(storeSku, err, storeSku.StoreID, model.VendorChineseNames[model.VendorIDDD], syncType) + globals.SugarLogger.Debugf("===========2 failedList %s", utils.Format4Output(failedList, false)) } + globals.SugarLogger.Debugf("===========2") + // 同步库存 paramStock := &sku_syncStock_request.SkuSyncStockParam{ ProductId: childrenProductId, @@ -510,17 +514,21 @@ func upDateChildrenPriceStockLaunch(api *tiktokShop.API, storeSku *dao.StoreSkuS } if err := api.UpdateSkuStock(paramStock); err != nil { failedList = append(failedList, putils.GetErrMsg2FailedSingleList(storeSku, err, storeSku.StoreID, model.VendorChineseNames[model.VendorIDDD], fmt.Sprintf("子商品添加固定库存.%s", err.Error()))...) + globals.SugarLogger.Debugf("===========3 failedList %s", utils.Format4Output(failedList, false)) } + globals.SugarLogger.Debugf("===========3") + // 上架 if err := api.LaunchProduct(childrenProductId); err != nil { failedList = append(failedList, putils.GetErrMsg2FailedSingleList(storeSku, err, storeSku.StoreID, model.VendorChineseNames[model.VendorIDDD], fmt.Sprintf("上架子商品异常.%s", err.Error()))...) + globals.SugarLogger.Debugf("===========4 failedList %s", utils.Format4Output(failedList, false)) } if len(failedList) > 0 { storeSku.SkuSyncStatus = model.SyncFlagStoreSkuModifiedMask } else { storeSku.SkuSyncStatus = 0 } - globals.SugarLogger.Debugf("====upDateChildrenPriceStockLaunch===,%s", utils.Format4Output(failedList, false)) + globals.SugarLogger.Debugf("====upDateChildrenPriceStockLaunch=== 444444,%s", utils.Format4Output(failedList, false)) return failedList } @@ -532,6 +540,7 @@ func getProductSkuID(api *tiktokShop.API, storeSku *dao.StoreSkuSyncInfo, syncTy childrenDetail, err := api.GetSkuDetail(utils.Int64ToStr(productId), "") if err != nil { failedList = putils.GetErrMsg2FailedSingleList(storeSku, err, storeSku.StoreID, model.VendorChineseNames[model.VendorIDDD], syncType) + return 0, failedList } for _, v := range childrenDetail.SpecPrices {