From 098d90228bebe9e0245860f3d620ae30ea885ad1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 14 Mar 2023 16:32:47 +0800 Subject: [PATCH 1/5] 1 --- .../partner/purchase/tiktok_store/store_sku2_utils.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/business/partner/purchase/tiktok_store/store_sku2_utils.go b/business/partner/purchase/tiktok_store/store_sku2_utils.go index 57ca83921..0ee130a88 100644 --- a/business/partner/purchase/tiktok_store/store_sku2_utils.go +++ b/business/partner/purchase/tiktok_store/store_sku2_utils.go @@ -136,7 +136,7 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI if storeSku.VendorMainId != "" && storeSku.VendorSkuID != "" && len(storeSku.VendorSkuID) == 19 { continue } - if storeSku.StoreSkuStatus != 1 { // 未可售的商品不参与修改 + if storeSku.StoreSkuStatus != model.YES { // 未可售的商品不参与修改 continue } @@ -278,7 +278,8 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI } // 同步价格,库存,上架 - upDateChildrenPriceStockLaunch(api, storeSku, childrenProductId, vendorStoreID, syncType) + failedList2 := upDateChildrenPriceStockLaunch(api, storeSku, childrenProductId, vendorStoreID, syncType) + failedList = append(failedList, failedList2...) storeSku.VendorSonSkuID = utils.Int64ToStr(childrenProductId) // (属性id skuID方案一)(自商品的商品id方案二) storeSku.VendorSkuID = utils.Int64ToStr(childrenProductId) // 子商品主id storeSku.VendorMainId = localThing[0].VendorThingID // 商品主id @@ -372,7 +373,9 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI //// 同步价格,库存,上架 //storeSku.VendorSonSkuID = utils.Int64ToStr(childrenProductId) // (属性id skuID方案一)(自商品的商品id方案二) //storeSku.VendorSkuID = utils.Int64ToStr(childrenProductId) // 子商品主id - upDateChildrenPriceStockLaunch(api, storeSku, utils.Str2Int64(storeSku.VendorSkuID), vendorStoreID, syncType) + failedList2 := upDateChildrenPriceStockLaunch(api, storeSku, utils.Str2Int64(storeSku.VendorSkuID), vendorStoreID, syncType) + failedList = append(failedList, failedList2...) + continue } From 24b42448ee08b036b0282fb48fca7fc5540c16f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 14 Mar 2023 16:51:14 +0800 Subject: [PATCH 2/5] 1 --- business/partner/purchase/tiktok_store/store_sku2_utils.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/business/partner/purchase/tiktok_store/store_sku2_utils.go b/business/partner/purchase/tiktok_store/store_sku2_utils.go index 0ee130a88..9c9447259 100644 --- a/business/partner/purchase/tiktok_store/store_sku2_utils.go +++ b/business/partner/purchase/tiktok_store/store_sku2_utils.go @@ -226,6 +226,7 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI } else if localThing[0].SyncStatus == model.ThingTypeSyncSuccess { // 主商品存在,直接同步子商品 childrenProductId, err := api.CreateSubProduct(utils.Str2Int64(localThing[0].VendorThingID), utils.Str2Int64(vendorStoreID)) + globals.SugarLogger.Debugf("childrenProductId=============:%s", utils.Format4Output(err, false)) if err != nil && strings.Contains(err.Error(), "2010004") { // 2010004:主商品非在线审核通过状态,不允许绑定子商品 // 线上本地都存在,但是线上审核不成功,就去更新主商品 mainOrderDetail = loadMainProductId(api, storeSku, localThing[0].VendorThingID) @@ -279,6 +280,7 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI // 同步价格,库存,上架 failedList2 := upDateChildrenPriceStockLaunch(api, storeSku, childrenProductId, vendorStoreID, syncType) + globals.SugarLogger.Debugf("upDateChildrenPriceStockLaunch=============:%s", utils.Format4Output(failedList2, false)) failedList = append(failedList, failedList2...) storeSku.VendorSonSkuID = utils.Int64ToStr(childrenProductId) // (属性id skuID方案一)(自商品的商品id方案二) storeSku.VendorSkuID = utils.Int64ToStr(childrenProductId) // 子商品主id From d1b4872b71f36e9ce7c2feed1067139d0df167e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 14 Mar 2023 17:32:23 +0800 Subject: [PATCH 3/5] 1 --- business/partner/purchase/tiktok_store/store_sku2_utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/partner/purchase/tiktok_store/store_sku2_utils.go b/business/partner/purchase/tiktok_store/store_sku2_utils.go index 9c9447259..3686b1e16 100644 --- a/business/partner/purchase/tiktok_store/store_sku2_utils.go +++ b/business/partner/purchase/tiktok_store/store_sku2_utils.go @@ -664,7 +664,7 @@ func upDateChildrenPriceStockLaunch(api *tiktokShop.API, storeSku *dao.StoreSkuS // 查询商品详情,获取商品的抖音skuId func getProductSkuID(api *tiktokShop.API, storeSku *dao.StoreSkuSyncInfo, syncType string, productId int64) (childrenSkuId int64, failedList []*partner.StoreSkuInfoWithErr) { - if storeSku.VendorSonSkuID != "" && storeSku.VendorSonSkuID != storeSku.VendorSkuID { + if storeSku.VendorSonSkuID != "" && storeSku.VendorSonSkuID != storeSku.VendorSkuID && utils.Int2Str(storeSku.SkuID) != storeSku.VendorSkuID { return utils.Str2Int64(storeSku.VendorSonSkuID), nil } childrenDetail, err := api.GetSkuDetail(utils.Int64ToStr(productId), "") From d61e786e274a502a985d837ef907f5ce1f4a63ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 14 Mar 2023 17:45:39 +0800 Subject: [PATCH 4/5] 1 --- business/partner/purchase/tiktok_store/store_sku2_utils.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/business/partner/purchase/tiktok_store/store_sku2_utils.go b/business/partner/purchase/tiktok_store/store_sku2_utils.go index 3686b1e16..7853daf75 100644 --- a/business/partner/purchase/tiktok_store/store_sku2_utils.go +++ b/business/partner/purchase/tiktok_store/store_sku2_utils.go @@ -664,6 +664,8 @@ func upDateChildrenPriceStockLaunch(api *tiktokShop.API, storeSku *dao.StoreSkuS // 查询商品详情,获取商品的抖音skuId func getProductSkuID(api *tiktokShop.API, storeSku *dao.StoreSkuSyncInfo, syncType string, productId int64) (childrenSkuId int64, failedList []*partner.StoreSkuInfoWithErr) { + globals.SugarLogger.Debugf("storeSku========:%s", utils.Format4Output(storeSku, false)) + globals.SugarLogger.Debugf("productId========:%s", utils.Format4Output(productId, false)) if storeSku.VendorSonSkuID != "" && storeSku.VendorSonSkuID != storeSku.VendorSkuID && utils.Int2Str(storeSku.SkuID) != storeSku.VendorSkuID { return utils.Str2Int64(storeSku.VendorSonSkuID), nil } From 14e69dc4fdc37a439f236a1762ac8534b273040a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 14 Mar 2023 18:13:17 +0800 Subject: [PATCH 5/5] 1 --- business/partner/purchase/tiktok_store/store_sku2_utils.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/business/partner/purchase/tiktok_store/store_sku2_utils.go b/business/partner/purchase/tiktok_store/store_sku2_utils.go index 7853daf75..3ae467899 100644 --- a/business/partner/purchase/tiktok_store/store_sku2_utils.go +++ b/business/partner/purchase/tiktok_store/store_sku2_utils.go @@ -226,7 +226,6 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI } else if localThing[0].SyncStatus == model.ThingTypeSyncSuccess { // 主商品存在,直接同步子商品 childrenProductId, err := api.CreateSubProduct(utils.Str2Int64(localThing[0].VendorThingID), utils.Str2Int64(vendorStoreID)) - globals.SugarLogger.Debugf("childrenProductId=============:%s", utils.Format4Output(err, false)) if err != nil && strings.Contains(err.Error(), "2010004") { // 2010004:主商品非在线审核通过状态,不允许绑定子商品 // 线上本地都存在,但是线上审核不成功,就去更新主商品 mainOrderDetail = loadMainProductId(api, storeSku, localThing[0].VendorThingID) @@ -280,7 +279,6 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI // 同步价格,库存,上架 failedList2 := upDateChildrenPriceStockLaunch(api, storeSku, childrenProductId, vendorStoreID, syncType) - globals.SugarLogger.Debugf("upDateChildrenPriceStockLaunch=============:%s", utils.Format4Output(failedList2, false)) failedList = append(failedList, failedList2...) storeSku.VendorSonSkuID = utils.Int64ToStr(childrenProductId) // (属性id skuID方案一)(自商品的商品id方案二) storeSku.VendorSkuID = utils.Int64ToStr(childrenProductId) // 子商品主id @@ -664,8 +662,6 @@ func upDateChildrenPriceStockLaunch(api *tiktokShop.API, storeSku *dao.StoreSkuS // 查询商品详情,获取商品的抖音skuId func getProductSkuID(api *tiktokShop.API, storeSku *dao.StoreSkuSyncInfo, syncType string, productId int64) (childrenSkuId int64, failedList []*partner.StoreSkuInfoWithErr) { - globals.SugarLogger.Debugf("storeSku========:%s", utils.Format4Output(storeSku, false)) - globals.SugarLogger.Debugf("productId========:%s", utils.Format4Output(productId, false)) if storeSku.VendorSonSkuID != "" && storeSku.VendorSonSkuID != storeSku.VendorSkuID && utils.Int2Str(storeSku.SkuID) != storeSku.VendorSkuID { return utils.Str2Int64(storeSku.VendorSonSkuID), nil }