This commit is contained in:
邹宗楠
2025-02-12 16:23:41 +08:00
parent 57c620b671
commit b2cc8bfb64

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"
beego "github.com/astaxie/beego/server/web"
"strings"
"time"
@@ -151,7 +152,9 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
}
if len(localThing) == 0 {
globals.SugarLogger.Debugf("--------------1")
param, failedList2 := makeMainProductSku(db, api, storeSku, storeDetail, storeID, vendorStoreID, syncType)
globals.SugarLogger.Debugf("--------------2")
if len(failedList2) != 0 {
storeSku.SkuSyncStatus = model.SyncFlagNewMask // 只创建主品,子品都没做
failedList = append(failedList, failedList2...)
@@ -467,6 +470,7 @@ func makeMainProductSku(db *dao.DaoDB, api *tiktokShop.API, storeSku *dao.StoreS
PickupMethod: "0",
OuterProductId: utils.Int2Str(storeSku.SkuID), // 本地skuId为外部商品id
}
globals.SugarLogger.Debugf("--------------2")
param.Name = checkNameLenght(param.Name)
// 获取上传图,商品轮播图
@@ -475,6 +479,7 @@ func makeMainProductSku(db *dao.DaoDB, api *tiktokShop.API, storeSku *dao.StoreS
failedList = putils.GetErrMsg2FailedSingleList(storeSku, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
return
}
globals.SugarLogger.Debugf("--------------4")
param.Pic = img
param.Description = detailImg
param.WhiteBackGroundPicUrl = whiteImg
@@ -494,6 +499,7 @@ func makeMainProductSku(db *dao.DaoDB, api *tiktokShop.API, storeSku *dao.StoreS
}
param.CategoryLeafId = vendorCategoryId
}
globals.SugarLogger.Debugf("--------------5")
// 这个情况是原有商品不存在和推荐查询不到类目id是,使用京西类目和抖音类目的绑定关系
// 但是不太实用,导致商品类目错误被暂停营业等
//if storeSku.VendorVendorCatID != 0 && param.CategoryLeafId == 0 {
@@ -506,6 +512,7 @@ func makeMainProductSku(db *dao.DaoDB, api *tiktokShop.API, storeSku *dao.StoreS
} else {
param.Supply7dayReturn = 0
}
globals.SugarLogger.Debugf("--------------6")
// weight_unit 目前抖音只支持g和kg两种
param.WeightUnit = tiktokShop.WeightUint_G
@@ -523,6 +530,7 @@ func makeMainProductSku(db *dao.DaoDB, api *tiktokShop.API, storeSku *dao.StoreS
return
}
}
globals.SugarLogger.Debugf("--------------7")
if param.StandardBrandId == 0 {
param.StandardBrandId, _ = getTiktokBrandId(api, db, storeSku.Upc, storeSku.UpcBrandName, storeSku.UpcTiktokBrandId, param.CategoryLeafId)
@@ -530,11 +538,13 @@ func makeMainProductSku(db *dao.DaoDB, api *tiktokShop.API, storeSku *dao.StoreS
if param.StandardBrandId == 0 {
param.StandardBrandId = 596120136
}
globals.SugarLogger.Debugf("--------------8")
param.FreightId, param.SaleLimitId, err = getFreightIdAndSaleLimitId(api, db, storeDetail, vendorStoreID)
if err != nil {
failedList = putils.GetErrMsg2FailedSingleList(storeSku, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
return
}
globals.SugarLogger.Debugf("--------------9")
return
}