1
This commit is contained in:
@@ -219,7 +219,6 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
||||
failedList = putils.GetErrMsg2FailedSingleList(storeSku, errors.New("只创建了主商品,没创建子商品"), storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
|
||||
} else if localThing[0].SyncStatus == model.ThingTypeSyncFail { // 同步失败在重新创建
|
||||
param, failedList2 := makeMainProductSku(db, api, storeSku, storeDetail, storeID, vendorStoreID, syncType)
|
||||
globals.SugarLogger.Debugf("----------param := %s", utils.Format4Output(param, false))
|
||||
if len(failedList2) != 0 {
|
||||
failedList = append(failedList, failedList2...)
|
||||
continue
|
||||
@@ -478,12 +477,9 @@ func makeMainProductSku(db *dao.DaoDB, api *tiktokShop.API, storeSku *dao.StoreS
|
||||
OuterProductId: utils.Int2Str(storeSku.SkuID), // 本地skuId为外部商品id
|
||||
}
|
||||
param.Name = checkNameLenght(param.Name)
|
||||
globals.SugarLogger.Debugf("----------param := %s", utils.Format4Output(1, false))
|
||||
|
||||
// 获取上传图,商品轮播图
|
||||
img, detailImg, whiteImg, err := GetTiktokImgList(api, utils.Int2Str(storeSku.StoreID), storeSku.SkuID, storeSku.DescImg, storeSku.Img, []string{storeSku.Img2, storeSku.Img3, storeSku.Img4, storeSku.Img5})
|
||||
globals.SugarLogger.Debugf("----------GetTiktokImgList := %s", utils.Format4Output(img, false))
|
||||
globals.SugarLogger.Debugf("----------err := %v", err)
|
||||
if err != nil {
|
||||
failedList = putils.GetErrMsg2FailedSingleList(storeSku, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
|
||||
return
|
||||
@@ -507,7 +503,6 @@ func makeMainProductSku(db *dao.DaoDB, api *tiktokShop.API, storeSku *dao.StoreS
|
||||
}
|
||||
param.CategoryLeafId = vendorCategoryId
|
||||
}
|
||||
globals.SugarLogger.Debugf("----------333 := %s", utils.Format4Output(3333, false))
|
||||
// 这个情况是原有商品不存在和推荐查询不到类目id是,使用京西类目和抖音类目的绑定关系
|
||||
// 但是不太实用,导致商品类目错误被暂停营业等
|
||||
//if storeSku.VendorVendorCatID != 0 && param.CategoryLeafId == 0 {
|
||||
@@ -955,7 +950,6 @@ func GetTiktokImgList(api *tiktokShop.API, storeId string, skuId int, detailImg,
|
||||
detailTiktok := ""
|
||||
whiteTiktok := ""
|
||||
tiktokImgLocal, err := dao.GetVendorImg(skuId, model.VendorIDDD)
|
||||
globals.SugarLogger.Debugf("----------tiktokImgLocal := %s", utils.Format4Output(tiktokImgLocal, false))
|
||||
if err == nil && tiktokImgLocal != nil && tiktokImgLocal.Img != "" {
|
||||
localImgs := make([]string, 0, 0)
|
||||
localImgs = append(localImgs, tiktokImgLocal.Img)
|
||||
@@ -989,7 +983,6 @@ func GetTiktokImgList(api *tiktokShop.API, storeId string, skuId int, detailImg,
|
||||
})
|
||||
}
|
||||
}
|
||||
globals.SugarLogger.Debugf("----------imgs := %s", utils.Format4Output(imgs, false))
|
||||
if detailImg != "" {
|
||||
imgs = append(imgs, tiktokShop.Imgs{
|
||||
Name: "detail_" + storeId + "_" + detailImg[21:54],
|
||||
@@ -1003,8 +996,6 @@ func GetTiktokImgList(api *tiktokShop.API, storeId string, skuId int, detailImg,
|
||||
})
|
||||
}
|
||||
tiktokImgList, err := api.BatchUploadImages(imgs)
|
||||
globals.SugarLogger.Debugf("----------tiktokImgList := %s", utils.Format4Output(tiktokImgList, false))
|
||||
globals.SugarLogger.Debugf("----------err := %s", utils.Format4Output(err, false))
|
||||
if err != nil {
|
||||
return "", "", "", err
|
||||
}
|
||||
@@ -1021,24 +1012,17 @@ func GetTiktokImgList(api *tiktokShop.API, storeId string, skuId int, detailImg,
|
||||
if strings.Contains(k, "detail_") {
|
||||
detailTiktok = v.ByteUrl
|
||||
localTiktokObj.DescImg = v.ByteUrl
|
||||
tiktokImg = append(tiktokImg, v.ByteUrl)
|
||||
continue
|
||||
}
|
||||
if strings.Contains(k, "white_") {
|
||||
whiteTiktok = v.ByteUrl
|
||||
localTiktokObj.Img = v.ByteUrl
|
||||
tiktokImg = append(tiktokImg, v.ByteUrl)
|
||||
continue
|
||||
}
|
||||
tiktokImg = append(tiktokImg, v.ByteUrl)
|
||||
}
|
||||
|
||||
if detailTiktok == "" {
|
||||
detailTiktok = tiktokImg[0]
|
||||
localTiktokObj.DescImg = detailTiktok
|
||||
}
|
||||
if whiteTiktok == "" {
|
||||
whiteTiktok = tiktokImg[0]
|
||||
localTiktokObj.Img = whiteTiktok
|
||||
}
|
||||
switch len(tiktokImg) {
|
||||
case 2:
|
||||
localTiktokObj.Img2 = tiktokImg[0]
|
||||
|
||||
Reference in New Issue
Block a user