Browse Source

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

lyhzzz 3 years ago
parent
commit
37962254a4

+ 14 - 0
platform-shop/src/main/java/com/platform/controller/GoodsController.java

@@ -125,6 +125,13 @@ public class GoodsController extends AbstractController{
         if(goods.getName().length() > 15){
             return Result.failure("商品名称名称不能超过15个字符");
         }
+        if(StringUtils.isEmpty(goods.getBrandId())){
+            throw new RRException("直播间id为空");
+        }
+        BrandEntity brand = brandService.queryObject(goods.getBrandId());
+        if(brand == null){
+            throw new RRException("直播间为空");
+        }
         goodsService.save(goods);
         //发送数据给api平台
         sendDataToApi(goods);
@@ -336,6 +343,13 @@ public class GoodsController extends AbstractController{
         if(null == goodsEntity){
             return Result.failure("商品不存在");
         }
+        if(StringUtils.isEmpty(goods.getBrandId())){
+            throw new RRException("直播间id为空");
+        }
+        BrandEntity brand = brandService.queryObject(goods.getBrandId());
+        if(brand == null){
+            throw new RRException("直播间为空");
+        }
         goodsService.update(goods);
 
         //发送数据给api平台