From 3312d17e306e8d9ff5e74d699af1d3bfdda46a26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 17 May 2024 16:22:01 +0800 Subject: [PATCH] 1 --- business/jxstore/cms/sync_store_sku.go | 11 ++++++++++- .../partner/purchase/tiktok_store/store_sku2_utils.go | 5 ----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index 69ea48412..6dad24654 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -783,13 +783,19 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag if len(createList) > 0 { _, err = putils.FreeBatchStoreSkuSyncInfo("创建门店商品", func(task tasksch.ITask, batchedStoreSkuList []*dao.StoreSkuSyncInfo) (result interface{}, successCount int, err error) { var failedList []*partner.StoreSkuInfoWithErr - if failedList, err = singleStoreHandler.CreateStoreSkus(ctx, storeID, vendorStoreID, batchedStoreSkuList); singleStoreHandler.IsErrSkuExist(err) { + failedList, err = singleStoreHandler.CreateStoreSkus(ctx, storeID, vendorStoreID, batchedStoreSkuList) + globals.SugarLogger.Debugf("==========failedList := %s", utils.Format4Output(failedList, false)) + globals.SugarLogger.Debugf("==========failedList := %v", err) + globals.SugarLogger.Debugf("==========failedList := %s", utils.Format4Output(singleStoreHandler.IsErrSkuExist(err), false)) + if singleStoreHandler.IsErrSkuExist(err) { + globals.SugarLogger.Debugf("==========failedList := %s", utils.Format4Output(1, false)) if skuNameList, err2 := singleStoreHandler.GetStoreSkusFullInfo(ctx, task, storeID, vendorStoreID, []*partner.StoreSkuInfo{ &partner.StoreSkuInfo{ SkuID: batchedStoreSkuList[0].SkuID, VendorSkuID: batchedStoreSkuList[0].VendorSkuID, }, }); err2 == nil && len(skuNameList) > 0 { + globals.SugarLogger.Debugf("==========failedList := %s", utils.Format4Output(2, false)) batchedStoreSkuList[0].VendorNameID = skuNameList[0].VendorNameID batchedStoreSkuList[0].VendorSkuID = skuNameList[0].SkuList[0].VendorSkuID @@ -801,6 +807,7 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag failedList = append(failedList, putils.GetErrMsg2FailedSingleList(batchedStoreSkuList, err2, storeID, model.VendorChineseNames[vendorID], "查询是否有该商品")...) } } + globals.SugarLogger.Debugf("==========failedList := %s", utils.Format4Output(3, false)) failedList, err = buildFailedListAndErr(failedList, err, nil, batchedStoreSkuList, storeID, vendorID, "创建门店商品") if len(failedList) > 0 { task.AddFailedList(failedList) @@ -810,6 +817,7 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag dao.InsertSensitiveWord(sensitiveWord, vendorID, ctx.GetUserName()) } } + globals.SugarLogger.Debugf("==========failedList := %s", utils.Format4Output(4, false)) successList := putils.UnselectStoreSkuSyncListByVendorSkuIDs(batchedStoreSkuList, GetVendorSkuIDList(failedList)) if len(successList) > 0 { _, err := updateStoreSku(dao.GetDB(), vendorID, successList, model.SyncFlagNewMask) @@ -817,6 +825,7 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag globals.SugarLogger.Debugf("20.sth wrong on updateStoreSku: %v", err) } } + globals.SugarLogger.Debugf("==========failedList := %s", utils.Format4Output(5, false)) return nil, len(successList), err }, ctx, task, createList, singleStoreHandler.GetStoreSkusBatchSize(partner.FuncUpdateStoreSkus), isContinueWhenError2) if err != nil { diff --git a/business/partner/purchase/tiktok_store/store_sku2_utils.go b/business/partner/purchase/tiktok_store/store_sku2_utils.go index 2bbd8dc0a..a59df2df2 100644 --- a/business/partner/purchase/tiktok_store/store_sku2_utils.go +++ b/business/partner/purchase/tiktok_store/store_sku2_utils.go @@ -5,7 +5,6 @@ import ( "errors" "fmt" product_addV2_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_addV2/response" - "git.rosy.net.cn/jx-callback/globals" "strings" "time" "unicode" @@ -152,7 +151,6 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI if len(localThing) == 0 { param, failedList2 := makeMainProductSku(db, api, storeSku, storeDetail, storeID, vendorStoreID, syncType) - globals.SugarLogger.Debugf("============param := %s", utils.Format4Output(param, false)) if len(failedList2) != 0 { storeSku.SkuSyncStatus = model.SyncFlagNewMask // 只创建主品,子品都没做 failedList = append(failedList, failedList2...) @@ -528,10 +526,7 @@ func makeMainProductSku(db *dao.DaoDB, api *tiktokShop.API, storeSku *dao.StoreS if param.StandardBrandId == 0 { param.StandardBrandId = 596120136 } - globals.SugarLogger.Debugf("============param := %s", utils.Format4Output(111111, false)) param.FreightId, param.SaleLimitId, err = getFreightIdAndSaleLimitId(api, db, storeDetail, vendorStoreID) - globals.SugarLogger.Debugf("============param.FreightId := %s", utils.Format4Output(param.FreightId, false)) - globals.SugarLogger.Debugf("============param.SaleLimitId := %s", utils.Format4Output(param.SaleLimitId, false)) if err != nil { failedList = putils.GetErrMsg2FailedSingleList(storeSku, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType) return