Browse Source

http://192.168.0.21/index.php?m=bug&f=view&bugID=25814

lyhzzz 3 years ago
parent
commit
e0441e90db

+ 6 - 0
platform-shop/src/main/java/com/platform/service/impl/GoodsServiceImpl.java

@@ -408,6 +408,9 @@ public class GoodsServiceImpl implements GoodsService {
     public int enSale(Integer id) {
         CurrentUserLoginVo user = ShiroUtils.getUserEntity();
         GoodsEntity goodsEntity = queryObject(id);
+        if(goodsEntity == null){
+            throw new RRException("此商品不存在!");
+        }
         if (1 == goodsEntity.getIsOnSale()) {
             throw new RRException("此商品已处于上架状态!");
         }
@@ -421,6 +424,9 @@ public class GoodsServiceImpl implements GoodsService {
     public int unSale(Integer id) {
         CurrentUserLoginVo user = ShiroUtils.getUserEntity();
         GoodsEntity goodsEntity = queryObject(id);
+        if(goodsEntity == null){
+            throw new RRException("此商品不存在!");
+        }
         if (0 == goodsEntity.getIsOnSale()) {
             throw new RRException("此商品已处于下架状态!");
         }