Browse Source

商品上下架的时候修改首页展示3

Yangzw 5 days ago
parent
commit
4bc6e0eb7e

+ 5 - 1
feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/service/spuapply/SpuApplyServiceImpl.java

@@ -366,10 +366,14 @@ public class SpuApplyServiceImpl implements SpuApplyService {
         // 修改首页面的商品展示,如果商品下架要看有没有展示,要去除
         if (updateReqVO.getStatus().equals(ProductSpuStatusEnum.DISABLE.getStatus())) {
             DiyPageDO diyPage = diyPageService.getDiyPage(7L);
-            if (diyPage.getProperty().contains(spu.getId().toString() + ",") || diyPage.getProperty().contains(spu.getId() + "]")) {
+            if (diyPage.getProperty().contains(spu.getId().toString() + ",")) {
                 diyPage.setProperty(diyPage.getProperty().replace(spu.getId() + ",", ""));
                 diyPageService.updateDiyPage(BeanUtils.toBean(diyPage, DiyPageUpdateReqVO.class));
             }
+            if(diyPage.getProperty().contains(spu.getId() + "]")){
+                diyPage.setProperty(diyPage.getProperty().replace(spu.getId() + "]", "]"));
+                diyPageService.updateDiyPage(BeanUtils.toBean(diyPage, DiyPageUpdateReqVO.class));
+            }
         }
     }