This commit is contained in:
邹宗楠
2022-12-12 16:51:23 +08:00
parent e6bcefa2c4
commit 19ca55180c

View File

@@ -151,6 +151,7 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
PickupMethod: "0",
OuterProductId: utils.Int2Str(storeSku.SkuID), // 本地skuId为外部商品id
}
globals.SugarLogger.Debugf("=======================1")
if len(param.Name) < 23 { // 中文字符一个汉字三个长度符号/数字/字母两个长度,商品名称不能大于
param.Name += utils.Float64ToStr(float64(storeSku.SpecQuality)) + "/" + storeSku.SpecUnit
if len(param.Name) < 23 {
@@ -168,6 +169,7 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
}
param.Pic = img
param.Description = detailImg
globals.SugarLogger.Debugf("=======================2")
// 部分商品没有所属的分类,直接跳过!
if storeSku.SkuVendorMapCatID != "" {
@@ -175,6 +177,7 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
} else if len(param.Pic) != 0 { // 自动推导分类id
param.CategoryLeafId = api.GetRecommendCategory(strings.Split(img, "|"))
}
globals.SugarLogger.Debugf("=======================3")
// 这个情况是原有商品不存在和推荐查询不到类目id是,使用京西类目和抖音类目的绑定关系
// 但是不太实用,导致商品类目错误被暂停营业等
//if storeSku.VendorVendorCatID != 0 && param.CategoryLeafId == 0 {
@@ -190,6 +193,7 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
} else {
param.Supply7dayReturn = 0
}
globals.SugarLogger.Debugf("=======================4")
// weight_unit 目前抖音只支持g和kg两种
param.WeightUnit = tiktokShop.WeightUint_G
@@ -210,9 +214,9 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
}
param.StandardBrandId = 789194134 // 默认品牌京西菜市 596120136
globals.SugarLogger.Debugf("=======================5")
temp, err := dao.QueryStoreBindInfo(storeDetail.Store.ID)
globals.SugarLogger.Debugf("=========temp %s", utils.Format4Output(temp, false))
if err != nil || temp == nil || temp.ID == 0 {
// 运费模板
param.FreightId, err = GetDeliveryTemp(api, vendorStoreID, storeDetail)
@@ -260,6 +264,7 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
dao.FreightTemplateMap[temp.StoreID] = temp
}
}
globals.SugarLogger.Debugf("=======================6")
// 根据本地商品id获取线上商品是否存在,存在则只创建子商品
var tiktokResultProductId int64 = 0