This commit is contained in:
邹宗楠
2023-10-26 16:09:26 +08:00
parent a3aff03c98
commit 5defccb4a7

View File

@@ -5,6 +5,7 @@ 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"
@@ -151,15 +152,19 @@ 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...)
continue
}
tiktokResult, err := api.CreateStoreCommodity(param) // 创建主商品,同步主商品
globals.SugarLogger.Debugf("====================tiktokResult := %s", utils.Format4Output(tiktokResult, false))
globals.SugarLogger.Debugf("====================err:= %v", err)
if err != nil {
if strings.Contains(err.Error(), "outProductId或者outerProductId已经存在") { // 主品以创建但是未返回出来
mainProductDetail, _ := api.GetSkuDetail("", utils.Int2Str(storeSku.SkuID))
globals.SugarLogger.Debugf("====================mainProductDetail := %s", utils.Format4Output(mainProductDetail, false))
if mainProductDetail != nil || mainProductDetail.ProductId != 0 {
tiktokResult.ProductId = mainProductDetail.ProductId