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) {
|
_, err = putils.FreeBatchStoreSkuSyncInfo("创建门店商品", func(task tasksch.ITask, batchedStoreSkuList []*dao.StoreSkuSyncInfo) (result interface{}, successCount int, err error) {
|
||||||
var failedList []*partner.StoreSkuInfoWithErr
|
var failedList []*partner.StoreSkuInfoWithErr
|
||||||
failedList, err = singleStoreHandler.CreateStoreSkus(ctx, storeID, vendorStoreID, batchedStoreSkuList)
|
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) {
|
if singleStoreHandler.IsErrSkuExist(err) {
|
||||||
globals.SugarLogger.Debugf("==========failedList := %s", utils.Format4Output(1, false))
|
|
||||||
if skuNameList, err2 := singleStoreHandler.GetStoreSkusFullInfo(ctx, task, storeID, vendorStoreID, []*partner.StoreSkuInfo{
|
if skuNameList, err2 := singleStoreHandler.GetStoreSkusFullInfo(ctx, task, storeID, vendorStoreID, []*partner.StoreSkuInfo{
|
||||||
&partner.StoreSkuInfo{
|
&partner.StoreSkuInfo{
|
||||||
SkuID: batchedStoreSkuList[0].SkuID,
|
SkuID: batchedStoreSkuList[0].SkuID,
|
||||||
VendorSkuID: batchedStoreSkuList[0].VendorSkuID,
|
VendorSkuID: batchedStoreSkuList[0].VendorSkuID,
|
||||||
},
|
},
|
||||||
}); err2 == nil && len(skuNameList) > 0 {
|
}); err2 == nil && len(skuNameList) > 0 {
|
||||||
globals.SugarLogger.Debugf("==========failedList := %s", utils.Format4Output(2, false))
|
|
||||||
batchedStoreSkuList[0].VendorNameID = skuNameList[0].VendorNameID
|
batchedStoreSkuList[0].VendorNameID = skuNameList[0].VendorNameID
|
||||||
batchedStoreSkuList[0].VendorSkuID = skuNameList[0].SkuList[0].VendorSkuID
|
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], "查询是否有该商品")...)
|
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, "创建门店商品")
|
failedList, err = buildFailedListAndErr(failedList, err, nil, batchedStoreSkuList, storeID, vendorID, "创建门店商品")
|
||||||
if len(failedList) > 0 {
|
if len(failedList) > 0 {
|
||||||
task.AddFailedList(failedList)
|
task.AddFailedList(failedList)
|
||||||
@@ -817,15 +811,16 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
|
|||||||
dao.InsertSensitiveWord(sensitiveWord, vendorID, ctx.GetUserName())
|
dao.InsertSensitiveWord(sensitiveWord, vendorID, ctx.GetUserName())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
globals.SugarLogger.Debugf("==========failedList := %s", utils.Format4Output(4, false))
|
|
||||||
successList := putils.UnselectStoreSkuSyncListByVendorSkuIDs(batchedStoreSkuList, GetVendorSkuIDList(failedList))
|
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 {
|
if len(successList) > 0 {
|
||||||
_, err := updateStoreSku(dao.GetDB(), vendorID, successList, model.SyncFlagNewMask)
|
_, err := updateStoreSku(dao.GetDB(), vendorID, successList, model.SyncFlagNewMask)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
globals.SugarLogger.Debugf("20.sth wrong on updateStoreSku: %v", err)
|
globals.SugarLogger.Debugf("20.sth wrong on updateStoreSku: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
globals.SugarLogger.Debugf("==========failedList := %s", utils.Format4Output(5, false))
|
|
||||||
return nil, len(successList), err
|
return nil, len(successList), err
|
||||||
}, ctx, task, createList, singleStoreHandler.GetStoreSkusBatchSize(partner.FuncUpdateStoreSkus), isContinueWhenError2)
|
}, ctx, task, createList, singleStoreHandler.GetStoreSkusBatchSize(partner.FuncUpdateStoreSkus), isContinueWhenError2)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
product_addV2_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_addV2/response"
|
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"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"unicode"
|
"unicode"
|
||||||
@@ -158,21 +157,16 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
tiktokResult, errCreate := api.CreateStoreCommodity(param) // 创建主商品,同步主商品
|
tiktokResult, errCreate := api.CreateStoreCommodity(param) // 创建主商品,同步主商品
|
||||||
globals.SugarLogger.Debugf("========tiktokResult ;= %s", utils.Format4Output(tiktokResult, false))
|
|
||||||
if tiktokResult == nil {
|
if tiktokResult == nil {
|
||||||
tiktokResult = &product_addV2_response.ProductAddV2Data{}
|
tiktokResult = &product_addV2_response.ProductAddV2Data{}
|
||||||
}
|
}
|
||||||
if errCreate != nil {
|
if errCreate != nil {
|
||||||
if strings.Contains(errCreate.Error(), "outProductId或者outerProductId已经存在") { // 主品以创建但是未返回出来
|
if strings.Contains(errCreate.Error(), "outProductId或者outerProductId已经存在") { // 主品以创建但是未返回出来
|
||||||
mainProductDetail, _ := api.GetSkuDetail("", utils.Int2Str(storeSku.SkuID))
|
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 {
|
if mainProductDetail != nil || mainProductDetail.ProductId != 0 {
|
||||||
tiktokResult.ProductId = mainProductDetail.ProductId
|
tiktokResult.ProductId = mainProductDetail.ProductId
|
||||||
specPrices := make([]product_addV2_response.SkuItem, 0, 0)
|
specPrices := make([]product_addV2_response.SkuItem, 0, 0)
|
||||||
globals.SugarLogger.Debugf("========mainProductDetail.SpecPrices ;= %s", utils.Format4Output(mainProductDetail.SpecPrices, false))
|
|
||||||
for _, v := range mainProductDetail.SpecPrices {
|
for _, v := range mainProductDetail.SpecPrices {
|
||||||
globals.SugarLogger.Debugf("========v ;= %s", utils.Format4Output(v, false))
|
|
||||||
specPrices = append(specPrices, product_addV2_response.SkuItem{
|
specPrices = append(specPrices, product_addV2_response.SkuItem{
|
||||||
SkuId: v.SkuId,
|
SkuId: v.SkuId,
|
||||||
OutSkuId: v.OutSkuId,
|
OutSkuId: v.OutSkuId,
|
||||||
@@ -203,7 +197,6 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
globals.SugarLogger.Debugf("========tiktokResult ;= %s", utils.Format4Output(tiktokResult, false))
|
|
||||||
|
|
||||||
if tiktokResult.ProductId > model.NO {
|
if tiktokResult.ProductId > model.NO {
|
||||||
dao.CreateThingMap(int64(storeSku.SkuID), utils.Int64ToStr(tiktokResult.ProductId), storeDetail.VendorOrgCode, "创建成功", model.ThingTypeSku, model.ThingTypeSyncSuccess)
|
dao.CreateThingMap(int64(storeSku.SkuID), utils.Int64ToStr(tiktokResult.ProductId), storeDetail.VendorOrgCode, "创建成功", model.ThingTypeSku, model.ThingTypeSyncSuccess)
|
||||||
|
|||||||
Reference in New Issue
Block a user