diff --git a/internal/v2/logic/third/supply.go b/internal/v2/logic/third/supply.go index 1dcc88d..4a87aff 100644 --- a/internal/v2/logic/third/supply.go +++ b/internal/v2/logic/third/supply.go @@ -281,7 +281,7 @@ func (s *supplyLogic) Adopt(data AdoptSkuInfo) error { } inventory := 0 - if thirdPartySupply.Status == manage.RecookThirdPartySupplySupplyStatusUp { + if thirdPartySupply.SupplyStatus == manage.RecookThirdPartySupplySupplyStatusUp { inventory = 500 } // sku信息处理 @@ -419,7 +419,7 @@ func (s *supplyLogic) Adopt(data AdoptSkuInfo) error { } inventory := 0 - if thirdPartySupply.Status == manage.RecookThirdPartySupplySupplyStatusUp { + if thirdPartySupply.SupplyStatus == manage.RecookThirdPartySupplySupplyStatusUp { inventory = 500 } // sku信息处理 @@ -483,9 +483,9 @@ func (s *supplyLogic) SyncPrice(skuIds []uint) error { for _, partySupply := range thirdPartySupplies { mysql.Db.Transaction(func(tx *gorm.DB) error { if tx.Model(&partySupply).Updates(map[string]interface{}{ - "price": partySupply.Price, - "guide_price": partySupply.GuidePrice, - "supply_status": partySupply.Status, + "price": mSkuPrice[partySupply.SupplySkuId].Price, + "guide_price": mSkuPrice[partySupply.SupplySkuId].GuidePrice, + "supply_status": mSkuPrice[partySupply.SupplySkuId].Status, }).Error != nil { return errors.New("更新失败") } @@ -493,7 +493,7 @@ func (s *supplyLogic) SyncPrice(skuIds []uint) error { if partySupply.Status == manage.RecookThirdPartySupplyStatusAdopt { // 上游上下架修改库存 inventory := 0 - if partySupply.Status == manage.RecookThirdPartySupplySupplyStatusUp { + if mSkuPrice[partySupply.SupplySkuId].Status == manage.RecookThirdPartySupplySupplyStatusUp { inventory = 500 } if tx.Model(&goods.RecookGoodsSkuModel{}).Where("third_party_type = ? and third_party_sku_id = ?", goods.RecookGoodsInfoThirdPartyTypeSupply, partySupply.SupplySkuId).Updates(map[string]interface{}{ @@ -527,28 +527,28 @@ func (s *supplyLogic) SyncData(skuIds []uint) error { // 更新商品 mysql.Db.Transaction(func(tx *gorm.DB) error { if tx.Model(&partySupply).Updates(map[string]interface{}{ - "name": partySupply.Name, - "brand_id": partySupply.BrandId, - "brand_name": partySupply.BrandName, - "first_category_id": partySupply.FirstCategoryId, - "first_category_name": partySupply.FirstCategoryName, - "second_category_id": partySupply.SecondCategoryId, - "second_category_name": partySupply.SecondCategoryName, - "third_category_id": partySupply.ThirdCategoryId, - "third_category_name": partySupply.ThirdCategoryName, - "price": partySupply.Price, - "guide_price": partySupply.GuidePrice, - "img_url": partySupply.ImgUrl, - "profit": partySupply.Profit, - "size": partySupply.Size, - "color": partySupply.Color, - "tax": partySupply.Tax, - "tax_code": partySupply.TaxCode, - "tax_name": partySupply.TaxName, - "unit": partySupply.Unit, - "upc_code": partySupply.UpcCode, - "content": partySupply.Content, - "supply_status": partySupply.Status, + "name": skuInfo.Name, + "brand_id": skuInfo.BrandId, + "brand_name": skuInfo.BrandName, + "first_category_id": skuInfo.FirstCategoryId, + "first_category_name": skuInfo.FirstCategoryName, + "second_category_id": skuInfo.SecondCategoryId, + "second_category_name": skuInfo.SecondCategoryName, + "third_category_id": skuInfo.ThirdCategoryId, + "third_category_name": skuInfo.ThirdCategoryName, + "price": skuInfo.Price, + "guide_price": skuInfo.GuidePrice, + "img_url": skuInfo.ImgUrl, + "profit": skuInfo.Profit, + "size": skuInfo.Size, + "color": skuInfo.Color, + "tax": skuInfo.Tax, + "tax_code": skuInfo.TaxCode, + "tax_name": skuInfo.TaxName, + "unit": skuInfo.Unit, + "upc_code": skuInfo.UpcCode, + "content": skuInfo.Content, + "supply_status": skuInfo.Status, }).Error != nil { return errors.New("更新失败") } @@ -665,7 +665,7 @@ func (s *supplyLogic) SyncData(skuIds []uint) error { // 上游上下架修改库存 inventory := 0 - if partySupply.Status == manage.RecookThirdPartySupplySupplyStatusUp { + if skuInfo.Status == manage.RecookThirdPartySupplySupplyStatusUp { inventory = 500 } if tx.Model(&goods.RecookGoodsSkuModel{}).Where("third_party_type = ? and third_party_sku_id = ?", goods.RecookGoodsInfoThirdPartyTypeSupply, partySupply.SupplySkuId).Updates(map[string]interface{}{