This commit is contained in:
邹宗楠
2023-10-10 15:25:30 +08:00
parent c26eb7f354
commit 92f5641592

View File

@@ -306,7 +306,6 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
param.Name = checkNameLenght(param.Name)
// 暂时只考虑修改白底图,提高效率.其余图片不做修改
globals.SugarLogger.Debugf("store_sku=========: %s", utils.Format4Output(storeSku, false))
img, descImg, whiteImg, err := GetTiktokImgList(api, utils.Int2Str(storeSku.StoreID), storeSku.SkuID, storeSku.DescImg, storeSku.Img, storeSku.Img2, storeSku.Img3, storeSku.Img4, storeSku.Img5)
if err != nil {
failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
@@ -321,8 +320,7 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
if storeSku.SkuVendorMapCatID != "" {
param.CategoryLeafId = utils.Str2Int64(storeSku.SkuVendorMapCatID)
} else if len(param.Pic) != 0 { // 自动推导分类id
globals.SugarLogger.Debugf("whiteImg ============= %s", utils.Format4Output(whiteImg, false))
param.CategoryLeafId, err = api.GetRecommendCategory([]string{whiteImg})
param.CategoryLeafId, err = api.GetRecommendCategory(strings.Split(img, "|"))
if param.CategoryLeafId == 0 || err != nil {
failedList = putils.GetErrMsg2FailedSingleList(storeSku, errors.New("当前商品本地未设置抖音分类/抖音推荐分类查询错误:"+err.Error()), storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
continue
@@ -943,7 +941,6 @@ func GetTiktokImgList(api *tiktokShop.API, storeId string, skuId int, detailImg,
if strings.Contains(k, "white_") {
whiteTiktok = v.ByteUrl
localTiktokObj.Img = v.ByteUrl
continue
}
tiktokImg = append(tiktokImg, v.ByteUrl)
}
@@ -973,6 +970,7 @@ func GetTiktokImgList(api *tiktokShop.API, storeId string, skuId int, detailImg,
localTiktokObj.Img4 = tiktokImg[2]
localTiktokObj.Img5 = tiktokImg[3]
}
globals.SugarLogger.Debugf("===========localTiktokObj := %s", utils.Format4Output(localTiktokObj, false))
dao.CreateEntity(dao.GetDB(), localTiktokObj)
return strings.Join(tiktokImg, "|"), detailTiktok, whiteTiktok, nil