lqmac 2 months ago
parent eb9b4cf024
commit 5c8eb7cb89
  1. 1
      app/store/model/Goods.php
  2. 1
      app/store/model/GoodsSku.php

@ -154,6 +154,7 @@ class Goods extends GoodsModel
//如果是编辑多规格商品 //如果是编辑多规格商品
if ($data['spec_type'] == GoodsSpecTypeEnum::MULTI) { if ($data['spec_type'] == GoodsSpecTypeEnum::MULTI) {
$data['spu_id'] = $this['goods_id']; $data['spu_id'] = $this['goods_id'];
//取消之前所有的商品组商品
} }
// 更新商品 // 更新商品
$this->save($data); $this->save($data);

@ -56,6 +56,7 @@ class GoodsSku extends GoodsSkuModel
//设置spu_id为当前商品id的商品的spu_id=0; by liuqing //设置spu_id为当前商品id的商品的spu_id=0; by liuqing
GoodsModel::where('spu_id', $goodsId)->update(['spu_id' => 0]); 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 //更新sku列表里面的商品id的spu_id
GoodsModel::whereIn('goods_id', $goodsIds)->update(['spu_id' => $goodsId]); GoodsModel::whereIn('goods_id', $goodsIds)->update(['spu_id' => $goodsId]);

Loading…
Cancel
Save