From 90b18778061805e4e31e989a6a7e2a0ae551385f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=98=8A=E5=A4=A9?= <442384644@qq.com> Date: Fri, 23 Oct 2026 19:08:46 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=95=86=E5=93=81):=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E8=BD=AF=E5=88=A0=E9=99=A4=E9=80=BB=E8=BE=91=EF=BC=8C=E7=A1=AE?= =?UTF-8?q?=E4=BF=9D=E5=95=86=E5=93=81=E4=B8=8B=E6=9E=B6=E5=B9=B6=E5=A4=B1?= =?UTF-8?q?=E6=95=88=E8=B4=AD=E7=89=A9=E8=BD=A6=E5=95=86=E5=93=81=E5=8F=8A?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E5=85=B3=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/normal/service/ProductServices.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/backend/modules/product/normal/service/ProductServices.php b/backend/modules/product/normal/service/ProductServices.php index b82df9160..10ffa1d5d 100644 --- a/backend/modules/product/normal/service/ProductServices.php +++ b/backend/modules/product/normal/service/ProductServices.php @@ -15,6 +15,8 @@ use modules\product\normal\dao\NormalProductSkuDao; use app\dao\product\CenterProductDao; use app\dao\product\product\StoreDescriptionDao; use app\dao\product\product\StoreProductCateDao; +use app\services\order\StoreCartServices; +use app\services\product\product\StoreProductCateServices; use app\model\product\CenterProductModel; use app\model\user\UserLabel; use think\facade\Db; @@ -513,13 +515,18 @@ class ProductServices // ===== 商品生命周期管理(中台主表 + 扩展表同步) ===== /** - * 软删除商品(仅中台主表标记 is_del=1,扩展表无 is_del 字段) + * 软删除商品(放入回收站) + * 中台主表同时置 is_del=1、is_show=0,保证进回收站的商品自动下架; + * 扩展表无 is_del/is_show 字段,无需同步。 * @param int $productId * @return void */ public function softDelete(int $productId): void { - $this->centerDao->update($productId, ['is_del' => 1]); + $this->centerDao->update($productId, ['is_del' => 1, 'is_show' => 0]); + // 与中台删除链路保持一致:失效购物车商品、停用分类关联 + app()->make(StoreCartServices::class)->changeStatus($productId, 0); + app()->make(StoreProductCateServices::class)->update(['product_id' => $productId], ['status' => 0]); } /**