|
|
|
@ -383,27 +383,27 @@ class Store extends Controller |
|
|
|
|
|
|
|
|
|
//删除分类 |
|
|
|
|
Category::where('store_id', $storeId)->delete(); |
|
|
|
|
GoodsSku::where('store_id', $storeId)->delete(); |
|
|
|
|
GoodsImage::where('store_id', $storeId)->delete(); |
|
|
|
|
GoodsSpecRel::where('store_id', $storeId)->delete(); |
|
|
|
|
GoodsModel::where('store_id', $storeId)->delete(); |
|
|
|
|
// $page = 1; |
|
|
|
|
// while (TRUE) { |
|
|
|
|
// $goods_list = GoodsModel::where('store_id', $storeId)->field('goods_id')->page($page)->limit(2000)->select(); |
|
|
|
|
// if ($goods_list->isEmpty()) { |
|
|
|
|
// return $this->renderSuccess(); |
|
|
|
|
// } |
|
|
|
|
// $goods_ids = array_column($goods_list->toArray(), "goods_id"); |
|
|
|
|
// //删除商品sku |
|
|
|
|
// GoodsSku::whereIn('goods_id', $goods_ids)->delete(); |
|
|
|
|
// //删除商品图片 |
|
|
|
|
// GoodsImage::whereIn('goods_id', $goods_ids)->delete(); |
|
|
|
|
// //删除商品规格 |
|
|
|
|
// GoodsSpecRel::whereIn('goods_id', $goods_ids)->delete(); |
|
|
|
|
// //删除商品 |
|
|
|
|
// GoodsModel::whereIn('goods_id', $goods_ids)->delete(); |
|
|
|
|
// $page++; |
|
|
|
|
// } |
|
|
|
|
// GoodsSku::where('store_id', $storeId)->delete(); |
|
|
|
|
// GoodsImage::where('store_id', $storeId)->delete(); |
|
|
|
|
// GoodsSpecRel::where('store_id', $storeId)->delete(); |
|
|
|
|
// GoodsModel::where('store_id', $storeId)->delete(); |
|
|
|
|
$page = 1; |
|
|
|
|
while (TRUE) { |
|
|
|
|
$goods_list = GoodsModel::where('store_id', $storeId)->where('channel','<>', 'zy')->field('goods_id')->page($page)->limit(2000)->select(); |
|
|
|
|
if ($goods_list->isEmpty()) { |
|
|
|
|
return $this->renderSuccess(); |
|
|
|
|
} |
|
|
|
|
$goods_ids = array_column($goods_list->toArray(), "goods_id"); |
|
|
|
|
//删除商品sku |
|
|
|
|
GoodsSku::whereIn('goods_id', $goods_ids)->delete(); |
|
|
|
|
//删除商品图片 |
|
|
|
|
GoodsImage::whereIn('goods_id', $goods_ids)->delete(); |
|
|
|
|
//删除商品规格 |
|
|
|
|
GoodsSpecRel::whereIn('goods_id', $goods_ids)->delete(); |
|
|
|
|
//删除商品 |
|
|
|
|
GoodsModel::whereIn('goods_id', $goods_ids)->delete(); |
|
|
|
|
$page++; |
|
|
|
|
} |
|
|
|
|
return $this->renderSuccess(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|