1
This commit is contained in:
@@ -784,18 +784,13 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
|
||||
_, err = putils.FreeBatchStoreSkuSyncInfo("创建门店商品", func(task tasksch.ITask, batchedStoreSkuList []*dao.StoreSkuSyncInfo) (result interface{}, successCount int, err error) {
|
||||
var failedList []*partner.StoreSkuInfoWithErr
|
||||
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
|
||||
|
||||
@@ -807,7 +802,6 @@ 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)
|
||||
@@ -817,15 +811,16 @@ 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))
|
||||
globals.SugarLogger.Debugf("======failedList := %s", utils.Format4Output(failedList, false))
|
||||
globals.SugarLogger.Debugf("======batchedStoreSkuList := %s", utils.Format4Output(batchedStoreSkuList, false))
|
||||
globals.SugarLogger.Debugf("======successList := %s", utils.Format4Output(successList, false))
|
||||
if len(successList) > 0 {
|
||||
_, err := updateStoreSku(dao.GetDB(), vendorID, successList, model.SyncFlagNewMask)
|
||||
if err != nil {
|
||||
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 {
|
||||
|
||||
@@ -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"
|
||||
@@ -158,21 +157,16 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
||||
continue
|
||||
}
|
||||
tiktokResult, errCreate := api.CreateStoreCommodity(param) // 创建主商品,同步主商品
|
||||
globals.SugarLogger.Debugf("========tiktokResult ;= %s", utils.Format4Output(tiktokResult, false))
|
||||
if tiktokResult == nil {
|
||||
tiktokResult = &product_addV2_response.ProductAddV2Data{}
|
||||
}
|
||||
if errCreate != nil {
|
||||
if strings.Contains(errCreate.Error(), "outProductId或者outerProductId已经存在") { // 主品以创建但是未返回出来
|
||||
mainProductDetail, _ := api.GetSkuDetail("", utils.Int2Str(storeSku.SkuID))
|
||||
globals.SugarLogger.Debugf("========v ;= %s", utils.Format4Output(mainProductDetail != nil, false))
|
||||
globals.SugarLogger.Debugf("========v ;= %s", utils.Format4Output(mainProductDetail.ProductId, false))
|
||||
if mainProductDetail != nil || mainProductDetail.ProductId != 0 {
|
||||
tiktokResult.ProductId = mainProductDetail.ProductId
|
||||
specPrices := make([]product_addV2_response.SkuItem, 0, 0)
|
||||
globals.SugarLogger.Debugf("========mainProductDetail.SpecPrices ;= %s", utils.Format4Output(mainProductDetail.SpecPrices, false))
|
||||
for _, v := range mainProductDetail.SpecPrices {
|
||||
globals.SugarLogger.Debugf("========v ;= %s", utils.Format4Output(v, false))
|
||||
specPrices = append(specPrices, product_addV2_response.SkuItem{
|
||||
SkuId: v.SkuId,
|
||||
OutSkuId: v.OutSkuId,
|
||||
@@ -203,7 +197,6 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
||||
continue
|
||||
}
|
||||
}
|
||||
globals.SugarLogger.Debugf("========tiktokResult ;= %s", utils.Format4Output(tiktokResult, false))
|
||||
|
||||
if tiktokResult.ProductId > model.NO {
|
||||
dao.CreateThingMap(int64(storeSku.SkuID), utils.Int64ToStr(tiktokResult.ProductId), storeDetail.VendorOrgCode, "创建成功", model.ThingTypeSku, model.ThingTypeSyncSuccess)
|
||||
|
||||
Reference in New Issue
Block a user