where('is_delete',1) ->field(['goods_id','is_sale','is_pool']) ->select(); if ($goods_list->isEmpty()) { return true; } $goodsIds = array_column($goods_list->toArray(), "goods_id"); $platformGoodsList = GoodsModel::whereIn('origin_goods_id', $goodsIds)->field(['goods_id','is_sale','is_pool'])->select(); if ($platformGoodsList->isEmpty()) { return true; } //删除零售总后台的商品 GoodsModel::whereIn('origin_goods_id', $goodsIds)->update(['is_delete' => 1, 'update_time' => time()]); //删除零售商城的商品 $platformGoodsIds = array_column($platformGoodsList->toArray(), "goods_id"); GoodsModel::whereIn('origin_goods_id', $platformGoodsIds)->update(['is_delete' => 1, 'update_time' => time()]); //删除批发商城总后台的商品 $wholesalePlatformGoodsList = Db::connect("dataCenterMysql")->table('yoshop_goods')->whereIn('origin_goods_id', $platformGoodsIds)->field(['goods_id','is_sale','is_pool'])->select(); if ($wholesalePlatformGoodsList->isEmpty()) { return true; } Db::connect("dataCenterMysql")->table('yoshop_goods')->whereIn('origin_goods_id', $platformGoodsIds)->update(['is_delete' => 1, 'update_time' => time()]); //删除批发商城-商城端的商品 $wholesalePlatformGoodsIds = array_column($wholesalePlatformGoodsList->toArray(), "goods_id"); Db::connect("dataCenterMysql")->table('yoshop_goods')->whereIn('origin_goods_id', $wholesalePlatformGoodsIds)->update(['is_delete' => 1, 'update_time' => time()]); return true; } }