1
This commit is contained in:
@@ -171,7 +171,7 @@ func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, vendorOr
|
||||
func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (failedList []*partner.StoreSkuInfoWithErr, err error) {
|
||||
api := getAPI(vendorOrgCode, storeID, vendorStoreID)
|
||||
for _, v := range storeSkuList {
|
||||
tiktokSkuId, failedList := getProductSkuId4UpdateStock(api, v, storeID)
|
||||
tiktokSkuId, failedList := getProductSkuId4UpdateStock(api, v, storeID, vendorStoreID)
|
||||
if len(failedList) > 0 {
|
||||
return failedList, err
|
||||
}
|
||||
|
||||
@@ -287,9 +287,14 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
||||
}
|
||||
}
|
||||
|
||||
if (err != nil || childrenProductId == 0) && !strings.Contains(err.Error(), "2010001") { // 2010001:重复创建渠道商品,就去更新
|
||||
failedList = putils.GetErrMsg2FailedSingleList(storeSku, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
|
||||
continue
|
||||
if err != nil && strings.Contains(err.Error(), "2010001") { // 2010001:重复创建渠道商品
|
||||
storeSkuDetail, err := api.GetSkuDetailLocalID(vendorStoreID, utils.Int2Str(storeSku.SkuID))
|
||||
if err != nil {
|
||||
failedList3 := putils.GetErrMsg2FailedSingleList(storeSku, errors.New("获取子品详情错误:"+err.Error()), storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
|
||||
failedList = append(failedList, failedList3...)
|
||||
continue
|
||||
}
|
||||
childrenProductId = storeSkuDetail.ProductId
|
||||
}
|
||||
|
||||
// 同步价格,库存,上架
|
||||
@@ -404,12 +409,12 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
||||
param.ProductId = mainIdInt
|
||||
param.MainProductId = mainIdInt
|
||||
param.SpecPrices = GetSpecPrices(param.Specs, vendorStoreID, param.MainProductId, storeSku)
|
||||
if err := api.EditStoreCommodity(param); err != nil {
|
||||
if err := api.EditStoreCommodity(param); err != nil && !strings.Contains(err.Error(), "您上传的商品主图存在重复") {
|
||||
failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
|
||||
storeSku.VendorSkuID = utils.Int2Str(storeSku.SkuID)
|
||||
} else {
|
||||
// todo 暂时关闭之后解开
|
||||
//upDateChildrenPriceStockLaunch(api, storeSku, utils.Str2Int64(storeSku.VendorSkuID), vendorStoreID, syncType)
|
||||
upDateChildrenPriceStockLaunch(api, storeSku, utils.Str2Int64(storeSku.VendorSkuID), vendorStoreID, syncType)
|
||||
}
|
||||
|
||||
//storeSku.SkuSyncStatus = model.SyncFlagStoreSkuModifiedMask // 品库修改 售卖状态待同步 价格待同步
|
||||
@@ -691,7 +696,7 @@ func getProductSkuID(api *tiktokShop.API, storeSku *dao.StoreSkuSyncInfo, syncTy
|
||||
return 0, putils.GetErrMsg2FailedSingleList(storeSku, fmt.Errorf("获取商品抖音skuId失败[%d]", productId), storeSku.StoreID, model.VendorChineseNames[model.VendorIDDD], syncType)
|
||||
}
|
||||
|
||||
func getProductSkuId4UpdateStock(api *tiktokShop.API, skuInfo *partner.StoreSkuInfo, storeId int) (tiktokSkuId int64, failedList []*partner.StoreSkuInfoWithErr) {
|
||||
func getProductSkuId4UpdateStock(api *tiktokShop.API, skuInfo *partner.StoreSkuInfo, storeId int, vendorStoreId string) (tiktokSkuId int64, failedList []*partner.StoreSkuInfoWithErr) {
|
||||
if skuInfo.VendorSonSkuID != "" && skuInfo.VendorSonSkuID != skuInfo.VendorSkuID && len(skuInfo.VendorSonSkuID) >= len("3589393056912261100") { // 抖音长度
|
||||
return utils.Str2Int64(skuInfo.VendorSonSkuID), nil
|
||||
}
|
||||
@@ -705,7 +710,7 @@ func getProductSkuId4UpdateStock(api *tiktokShop.API, skuInfo *partner.StoreSkuI
|
||||
return 0, failedList
|
||||
}
|
||||
} else {
|
||||
childrenSku, err = api.GetSkuDetailLocalID("", skuInfo.VendorSkuID)
|
||||
childrenSku, err = api.GetSkuDetailLocalID(vendorStoreId, skuInfo.VendorSkuID)
|
||||
if err != nil || len(childrenSku.SpecPrices) <= 0 {
|
||||
failedList = append(failedList, putils.GetErrMsg2FailedSingleList(skuInfo, err, storeId, model.VendorChineseNames[model.VendorIDDD], "修改库存[err为空,子商品skuId未获取到]")...)
|
||||
return 0, failedList
|
||||
|
||||
Reference in New Issue
Block a user