This commit is contained in:
邹宗楠
2024-05-17 16:22:01 +08:00
parent 2c9062d5b2
commit 3312d17e30
2 changed files with 10 additions and 6 deletions

View File

@@ -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 {

View File

@@ -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