From 06defa9c2360829d34fbb9ad5cd91043433c9964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 21 Nov 2022 16:40:53 +0800 Subject: [PATCH] 1 --- .../purchase/tiktok_store/store_sku2_utils.go | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/business/partner/purchase/tiktok_store/store_sku2_utils.go b/business/partner/purchase/tiktok_store/store_sku2_utils.go index d1ce83482..7bc7d671c 100644 --- a/business/partner/purchase/tiktok_store/store_sku2_utils.go +++ b/business/partner/purchase/tiktok_store/store_sku2_utils.go @@ -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)