This commit is contained in:
邹宗楠
2022-11-21 16:40:53 +08:00
parent dffe92533f
commit 06defa9c23

View File

@@ -150,27 +150,15 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
PickupMethod: "0",
OuterProductId: utils.Int2Str(storeSku.SkuID), // 本地skuId为外部商品id
}
// 部分商品没有所属的分类,直接跳过!
if storeSku.SkuVendorMapCatID != "" {
param.CategoryLeafId = utils.Str2Int64(storeSku.SkuVendorMapCatID)
} else if storeSku.VendorVendorCatID != 0 {
param.CategoryLeafId = storeSku.VendorVendorCatID
} else {
continue
}
if len(param.Name) < 23 { // 中文字符一个汉字三个长度符号/数字/字母两个长度,商品名称不能大于
param.Name += utils.Float64ToStr(float64(storeSku.SpecQuality)) + storeSku.SpecUnit + " "
param.Name += utils.Float64ToStr(float64(storeSku.SpecQuality)) + storeSku.SpecUnit
if len(param.Name) < 23 {
param.Name += " 推荐产品 "
}
} else if len(param.Name) > 90 { // 抖音最大60个字符,三十个汉字
param.Name = param.Name[0:90]
}
// 是否支持七天无理由
if api.GetProductUpdateRule(param.CategoryLeafId) {
param.Supply7dayReturn = 1
} else {
param.Supply7dayReturn = 0
}
// 获取上传图,商品轮播图
img, detailImg, err := GetTiktokImgList(api, utils.Int2Str(storeSku.StoreID), storeDetail.VendorOrgCode, storeSku.DescImg, storeSku.ImgOrigin, storeSku.Img2, storeSku.Img3, storeSku.Img4, storeSku.Img5)
if err != nil {
@@ -179,13 +167,25 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
param.Pic = img
param.Description = detailImg
// 部分商品没有所属的分类,直接跳过!
if storeSku.SkuVendorMapCatID != "" {
param.CategoryLeafId = utils.Str2Int64(storeSku.SkuVendorMapCatID)
} else if len(param.Pic) != 0 { // 自动推导分类id
param.CategoryLeafId = api.GetRecommendCategory(strings.Split(img, "|"))
}
if storeSku.VendorVendorCatID != 0 && param.CategoryLeafId == 0 {
param.CategoryLeafId = storeSku.VendorVendorCatID
}
// 是否支持七天无理由
if api.GetProductUpdateRule(param.CategoryLeafId) {
param.Supply7dayReturn = 1
} else {
param.Supply7dayReturn = 0
}
// weight_unit 目前抖音只支持g和kg两种
//switch storeSku.Unit {
//case "g", "ml", "G", "ML":
param.WeightUnit = tiktokShop.WeightUint_G
//case "kg", "l", "L", "KG":
// param.WeightUnit = tiktokShop.WeightUint_G
//}
// spec_prices
param.SpecPrices = GetSpecPrices(param.Specs, vendorStoreID, 0, storeSku)