From 5c8eb7cb89e11296d19738b83917b5f95b95e0f1 Mon Sep 17 00:00:00 2001 From: lqmac Date: Wed, 25 Sep 2024 21:29:26 +0800 Subject: [PATCH] 1 --- app/store/model/Goods.php | 1 + app/store/model/GoodsSku.php | 1 + 2 files changed, 2 insertions(+) diff --git a/app/store/model/Goods.php b/app/store/model/Goods.php index 0321db74..34464c93 100644 --- a/app/store/model/Goods.php +++ b/app/store/model/Goods.php @@ -154,6 +154,7 @@ class Goods extends GoodsModel //如果是编辑多规格商品 if ($data['spec_type'] == GoodsSpecTypeEnum::MULTI) { $data['spu_id'] = $this['goods_id']; + //取消之前所有的商品组商品 } // 更新商品 $this->save($data); diff --git a/app/store/model/GoodsSku.php b/app/store/model/GoodsSku.php index a6e8f46c..1e7b01c6 100644 --- a/app/store/model/GoodsSku.php +++ b/app/store/model/GoodsSku.php @@ -56,6 +56,7 @@ class GoodsSku extends GoodsSkuModel //设置spu_id为当前商品id的商品的spu_id=0; by liuqing GoodsModel::where('spu_id', $goodsId)->update(['spu_id' => 0]); + GoodsSku::where('spu_id', $goodsId)->update(['spu_id' => 0, 'goods_props' => "", 'spec_value_ids' => '']); //更新sku列表里面的商品id的spu_id GoodsModel::whereIn('goods_id', $goodsIds)->update(['spu_id' => $goodsId]);