银豹更新商品分类,尝试

This commit is contained in:
苏尹岚
2020-04-30 09:38:30 +08:00
parent d1a7afa363
commit daef0cbef3
2 changed files with 18 additions and 7 deletions

View File

@@ -62,7 +62,7 @@ func CalculateDeliveryFee(db *dao.DaoDB, jxStoreID int, hint string, consigneeLn
deliveryFee = priceInfo.CityPrice
}
if deliveryFee == 0 {
globals.SugarLogger.Warnf("CalculateOrderDeliveryFee 查不到美团配送价格 orderID:%s", hint)
// globals.SugarLogger.Warnf("CalculateOrderDeliveryFee 查不到美团配送价格 orderID:%s", hint)
deliveryFee = 650
}
if lng == 0 || lat == 0 {

View File

@@ -39,7 +39,7 @@ func (p *PurchaseHandler) CreateStoreSkus(ctx *jxcontext.Context, storeID int, v
storeSku.VendorSkuID = utils.Int64ToStr(result.UID)
uploadYbImage(vendorStoreID, storeSku.YbBarCode, storeSku.Img)
if !flag {
updateYbSku(vendorStoreID, storeSku.YbBarCode)
updateYbSku(vendorStoreID, storeSku.YbBarCode, nil)
}
}
}
@@ -47,6 +47,17 @@ func (p *PurchaseHandler) CreateStoreSkus(ctx *jxcontext.Context, storeID int, v
}
func (p *PurchaseHandler) UpdateStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*dao.StoreSkuSyncInfo) (failedList []*partner.StoreSkuInfoWithErr, err error) {
if globals.EnableYbStoreWrite {
for _, v := range storeSkuList {
saveProductParam := &yinbaoapi.SaveProductParam{
CategoryUid: v.VendorCatID,
}
updateYbSku(vendorStoreID, v.YbBarCode, saveProductParam)
if err != nil {
failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDYB], "修改商品")
}
}
}
return failedList, err
}
@@ -415,12 +426,12 @@ func loopPages(parameterType, parameterValue string, skuNameList *[]*partner.Sku
return err
}
for _, v := range resultPages.Result {
resultp, err := api.YinBaoAPI.QueryProductImagesByBarcode(v.Barcode)
// resultp, err := api.YinBaoAPI.QueryProductImagesByBarcode(v.Barcode)
// resultp, err := getProductImages(vendorStoreID, v.Barcode)
if err != nil {
return err
}
// var resultp []*yinbaoapi.QueryProductImagesByBarcodeResult
var resultp []*yinbaoapi.QueryProductImagesByBarcodeResult
vv := &yinbaoapi.QueryProductByBarcodeResult{}
err = utils.Map2StructByJson(utils.Struct2MapByJson(v), vv, false)
if skuName := vendorSku2Jx(vv, resultp); skuName != nil {
@@ -468,9 +479,9 @@ func convertVendorCatList(remoteCats []*yinbaoapi.LoadCategorysWithOptionResult)
return cats
}
func updateYbSku(vendorStoreID, ybBarCode string) (err error) {
func updateYbSku(vendorStoreID, ybBarCode string, saveProductParam *yinbaoapi.SaveProductParam) (err error) {
for {
err = api.YinBaoAPI.SaveProduct(vendorStoreID, ybBarCode)
err = api.YinBaoAPI.SaveProduct(vendorStoreID, ybBarCode, saveProductParam)
if err == nil {
break
} else {
@@ -479,7 +490,7 @@ func updateYbSku(vendorStoreID, ybBarCode string) (err error) {
if err != nil {
break
}
err = updateYbSku(vendorStoreID, ybBarCode)
err = updateYbSku(vendorStoreID, ybBarCode, saveProductParam)
} else {
break
}