diff --git a/business/partner/purchase/yb/store_sku.go b/business/partner/purchase/yb/store_sku.go index 09ba9b9bd..b8bfb6aa8 100644 --- a/business/partner/purchase/yb/store_sku.go +++ b/business/partner/purchase/yb/store_sku.go @@ -94,7 +94,17 @@ func (p *PurchaseHandler) GetStoreSkusFullInfo(ctx *jxcontext.Context, parentTas func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo, status int) (failedList []*partner.StoreSkuInfoWithErr, err error) { if globals.EnableYbStoreWrite { - + buildYbConfigs(storeID) + for _, v := range storeSkuList { + var productInfo = &yinbaoapi.ProductInfo{ + UID: utils.Str2Int64(v.VendorSkuID), + Enable: utils.Int2Pointer(ybSkuStatus2Jx(v.Status)), + } + err = api.YinBaoAPI.UpdateProductInfo(productInfo) + if err != nil { + failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDYB], "更新商品状态") + } + } } return failedList, err } @@ -106,6 +116,7 @@ func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, vendorOrg var productInfo = &yinbaoapi.ProductInfo{ UID: utils.Str2Int64(v.VendorSkuID), SellPrice: utils.Float64ToPointer(jxutils.IntPrice2Standard(v.VendorPrice)), + BuyPrice: utils.Float64ToPointer(jxutils.IntPrice2Standard(v.VendorPrice)), } err = api.YinBaoAPI.UpdateProductInfo(productInfo) if err != nil { @@ -118,7 +129,17 @@ func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, vendorOrg func (p *PurchaseHandler) UpdateStoreSkusStock(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (failedList []*partner.StoreSkuInfoWithErr, err error) { if globals.EnableYbStoreWrite { - + buildYbConfigs(storeID) + for _, v := range storeSkuList { + var productInfo = &yinbaoapi.ProductInfo{ + UID: utils.Str2Int64(v.VendorSkuID), + Stock: utils.Float64ToPointer(utils.Str2Float64(utils.Int2Str(v.Stock))), + } + err = api.YinBaoAPI.UpdateProductInfo(productInfo) + if err != nil { + failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDYB], "更新商品库存") + } + } } return failedList, err }